mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-07 16:48:02 +08:00
fix(spec): Stub correct method
This commit is contained in:
parent
3908ba402d
commit
7ad227cd9a
1 changed files with 6 additions and 6 deletions
|
@ -61,24 +61,24 @@ describe "FileDownloadStore", ->
|
|||
describe "_checkForDownloadedFile", ->
|
||||
it "should return true if the file exists at the path and is the right size", ->
|
||||
f = new File(filename: '123.png', contentType: 'image/png', id: "id", size: 100)
|
||||
spyOn(fs, 'stat').andCallFake (path, callback) ->
|
||||
callback(null, {size: 100})
|
||||
spyOn(fs, 'statAsync').andCallFake (path) ->
|
||||
Promise.resolve({size: 100})
|
||||
waitsForPromise ->
|
||||
FileDownloadStore._checkForDownloadedFile(f).then (downloaded) ->
|
||||
expect(downloaded).toBe(true)
|
||||
|
||||
it "should return false if the file does not exist", ->
|
||||
f = new File(filename: '123.png', contentType: 'image/png', id: "id", size: 100)
|
||||
spyOn(fs, 'stat').andCallFake (path, callback) ->
|
||||
callback(new Error("File does not exist"))
|
||||
spyOn(fs, 'statAsync').andCallFake (path) ->
|
||||
Promise.reject(new Error("File does not exist"))
|
||||
waitsForPromise ->
|
||||
FileDownloadStore._checkForDownloadedFile(f).then (downloaded) ->
|
||||
expect(downloaded).toBe(false)
|
||||
|
||||
it "should return false if the file is too small", ->
|
||||
f = new File(filename: '123.png', contentType: 'image/png', id: "id", size: 100)
|
||||
spyOn(fs, 'stat').andCallFake (path, callback) ->
|
||||
callback(null, {size: 50})
|
||||
spyOn(fs, 'statAsync').andCallFake (path) ->
|
||||
Promise.resolve({size: 50})
|
||||
waitsForPromise ->
|
||||
FileDownloadStore._checkForDownloadedFile(f).then (downloaded) ->
|
||||
expect(downloaded).toBe(false)
|
||||
|
|
Loading…
Reference in a new issue