From 7ad227cd9a0f8144fd060a966b82f02e5fabadac Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Fri, 28 Aug 2015 16:37:09 -0400 Subject: [PATCH] fix(spec): Stub correct method --- spec-nylas/stores/file-download-store-spec.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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)