فهرست منبع

test against rimraf module when deleting directory recursively

Brian Gough 11 سال پیش
والد
کامیت
efd6035849
1فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 7 3
      services/filestore/test/unit/coffee/FSPersistorManagerTests.coffee

+ 7 - 3
services/filestore/test/unit/coffee/FSPersistorManagerTests.coffee

@@ -6,6 +6,7 @@ expect = chai.expect
 modulePath = "../../../app/js/FSPersistorManager.js"
 modulePath = "../../../app/js/FSPersistorManager.js"
 SandboxedModule = require('sandboxed-module')
 SandboxedModule = require('sandboxed-module')
 fs = require("fs")
 fs = require("fs")
+response = require("response")
 
 
 describe "FSPersistorManagerTests", ->
 describe "FSPersistorManagerTests", ->
 
 
@@ -17,6 +18,7 @@ describe "FSPersistorManagerTests", ->
       unlink:sinon.stub()
       unlink:sinon.stub()
       rmdir:sinon.stub()
       rmdir:sinon.stub()
       exists:sinon.stub()
       exists:sinon.stub()
+    @Rimraf = sinon.stub()
     @LocalFileWriter =
     @LocalFileWriter =
       writeStream: sinon.stub()
       writeStream: sinon.stub()
     @requires =
     @requires =
@@ -25,6 +27,8 @@ describe "FSPersistorManagerTests", ->
       "logger-sharelatex":
       "logger-sharelatex":
         log:->
         log:->
         err:->
         err:->
+      "response":response
+      "rimraf":@Rimraf
     @location = "/tmp"
     @location = "/tmp"
     @name1 = "530f2407e7ef165704000007/530f838b46d9a9e859000008"
     @name1 = "530f2407e7ef165704000007/530f838b46d9a9e859000008"
     @name1Filtered ="530f2407e7ef165704000007_530f838b46d9a9e859000008"
     @name1Filtered ="530f2407e7ef165704000007_530f838b46d9a9e859000008"
@@ -115,11 +119,11 @@ describe "FSPersistorManagerTests", ->
 
 
   describe "deleteDirectory", ->
   describe "deleteDirectory", ->
     beforeEach ->
     beforeEach ->
-      @Fs.rmdir.callsArgWith(1,@error)
+      @Rimraf.callsArgWith(1,@error)
 
 
-    it "Should call rmdir with correct options", (done) ->
+    it "Should call rmdir(rimraf) with correct options", (done) ->
       @FSPersistorManager.deleteDirectory @location, @name1, (err) =>
       @FSPersistorManager.deleteDirectory @location, @name1, (err) =>
-        @Fs.rmdir.calledWith("#{@location}/#{@name1}").should.equal.true
+        @Rimraf.calledWith("#{@location}/#{@name1}").should.equal.true
         done()
         done()
 
 
     it "Should propogate the error", (done) ->
     it "Should propogate the error", (done) ->