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