From 563131636071e51044fb064edf3facd48fd1bae8 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 17 Jul 2015 17:13:16 -0700 Subject: [PATCH] fix(specs): Accidentally broke specs because they included my user folder --- .../composer/spec/composer-view-spec.cjsx | 11 +++++++---- spec-nylas/stores/file-download-store-spec.coffee | 13 +++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal_packages/composer/spec/composer-view-spec.cjsx b/internal_packages/composer/spec/composer-view-spec.cjsx index e369768a3..4a451b423 100644 --- a/internal_packages/composer/spec/composer-view-spec.cjsx +++ b/internal_packages/composer/spec/composer-view-spec.cjsx @@ -647,10 +647,13 @@ describe "populated composer", -> useDraft.call @, files: [@file1, @file2] makeComposer.call @ - it 'preloads attached image files', -> - expect(Actions.fetchFile).toHaveBeenCalled() - expect(Actions.fetchFile.calls.length).toBe 1 - expect(Actions.fetchFile.calls[0].args[0]).toBe @file2 + it 'starts fetching attached files', -> + waitsFor -> + Actions.fetchFile.callCount == 1 + runs -> + expect(Actions.fetchFile).toHaveBeenCalled() + expect(Actions.fetchFile.calls.length).toBe(1) + expect(Actions.fetchFile.calls[0].args[0]).toBe @file2 it 'injects an Attachment component for non image files', -> els = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@composer, InjectedComponent, matching: {role: "Attachment"}) diff --git a/spec-nylas/stores/file-download-store-spec.coffee b/spec-nylas/stores/file-download-store-spec.coffee index 654e64677..4ebc80278 100644 --- a/spec-nylas/stores/file-download-store-spec.coffee +++ b/spec-nylas/stores/file-download-store-spec.coffee @@ -9,19 +9,20 @@ describe "FileDownloadStore", -> spyOn(shell, 'openItem') @testfile = new File(filename: '123.png', contentType: 'image/png', id: 'id', size: 100) FileDownloadStore._downloads = {} + FileDownloadStore._downloadDirectory = "/Users/testuser/.nylas/downloads" describe "pathForFile", -> it "should return path within the download directory with the file id and displayName", -> f = new File(filename: '123.png', contentType: 'image/png', id: 'id') spyOn(f, 'displayName').andCallThrough() - expect(FileDownloadStore.pathForFile(f)).toBe("/Users/bengotow/.nylas-spec/downloads/id/123.png") + expect(FileDownloadStore.pathForFile(f)).toBe("/Users/testuser/.nylas/downloads/id/123.png") expect(f.displayName).toHaveBeenCalled() it "should return unique paths for identical filenames with different IDs", -> f1 = new File(filename: '123.png', contentType: 'image/png', id: 'id1') f2 = new File(filename: '123.png', contentType: 'image/png', id: 'id2') - expect(FileDownloadStore.pathForFile(f1)).toBe("/Users/bengotow/.nylas-spec/downloads/id1/123.png") - expect(FileDownloadStore.pathForFile(f2)).toBe("/Users/bengotow/.nylas-spec/downloads/id2/123.png") + expect(FileDownloadStore.pathForFile(f1)).toBe("/Users/testuser/.nylas/downloads/id1/123.png") + expect(FileDownloadStore.pathForFile(f2)).toBe("/Users/testuser/.nylas/downloads/id2/123.png") describe "_checkForDownloadedFile", -> it "should return true if the file exists at the path and is the right size", -> @@ -87,7 +88,7 @@ describe "FileDownloadStore", -> percent : 0, filename : '123.png', filesize : 100, - targetPath : '/Users/bengotow/.nylas-spec/downloads/id/123.png' + targetPath : '/Users/testuser/.nylas/downloads/id/123.png' }) describe "when the downloaded file does not exist", -> @@ -103,7 +104,7 @@ describe "FileDownloadStore", -> percent : 0, filename : '123.png', filesize : 100, - targetPath : '/Users/bengotow/.nylas-spec/downloads/id/123.png' + targetPath : '/Users/testuser/.nylas/downloads/id/123.png' }) it "should call download.run", -> @@ -122,7 +123,7 @@ describe "FileDownloadStore", -> percent : 0, filename : '123.png', filesize : 100, - targetPath : '/Users/bengotow/.nylas-spec/downloads/id/123.png' + targetPath : '/Users/testuser/.nylas/downloads/id/123.png' }) describe "_fetch", ->