diff --git a/spec-nylas/stores/file-download-store-spec.coffee b/spec-nylas/stores/file-download-store-spec.coffee index 115ce8cfc..23c932224 100644 --- a/spec-nylas/stores/file-download-store-spec.coffee +++ b/spec-nylas/stores/file-download-store-spec.coffee @@ -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)