fix(specs): Accidentally broke specs because they included my user folder

This commit is contained in:
Ben Gotow 2015-07-17 17:13:16 -07:00
parent 642121385d
commit 5631316360
2 changed files with 14 additions and 10 deletions

View file

@ -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"})

View file

@ -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", ->