mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-12-11 15:06:15 +08:00
fix(specs): Accidentally broke specs because they included my user folder
This commit is contained in:
parent
642121385d
commit
5631316360
2 changed files with 14 additions and 10 deletions
|
|
@ -647,10 +647,13 @@ describe "populated composer", ->
|
||||||
useDraft.call @, files: [@file1, @file2]
|
useDraft.call @, files: [@file1, @file2]
|
||||||
makeComposer.call @
|
makeComposer.call @
|
||||||
|
|
||||||
it 'preloads attached image files', ->
|
it 'starts fetching attached files', ->
|
||||||
expect(Actions.fetchFile).toHaveBeenCalled()
|
waitsFor ->
|
||||||
expect(Actions.fetchFile.calls.length).toBe 1
|
Actions.fetchFile.callCount == 1
|
||||||
expect(Actions.fetchFile.calls[0].args[0]).toBe @file2
|
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', ->
|
it 'injects an Attachment component for non image files', ->
|
||||||
els = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@composer, InjectedComponent, matching: {role: "Attachment"})
|
els = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@composer, InjectedComponent, matching: {role: "Attachment"})
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,20 @@ describe "FileDownloadStore", ->
|
||||||
spyOn(shell, 'openItem')
|
spyOn(shell, 'openItem')
|
||||||
@testfile = new File(filename: '123.png', contentType: 'image/png', id: 'id', size: 100)
|
@testfile = new File(filename: '123.png', contentType: 'image/png', id: 'id', size: 100)
|
||||||
FileDownloadStore._downloads = {}
|
FileDownloadStore._downloads = {}
|
||||||
|
FileDownloadStore._downloadDirectory = "/Users/testuser/.nylas/downloads"
|
||||||
|
|
||||||
describe "pathForFile", ->
|
describe "pathForFile", ->
|
||||||
it "should return path within the download directory with the file id and displayName", ->
|
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')
|
f = new File(filename: '123.png', contentType: 'image/png', id: 'id')
|
||||||
spyOn(f, 'displayName').andCallThrough()
|
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()
|
expect(f.displayName).toHaveBeenCalled()
|
||||||
|
|
||||||
it "should return unique paths for identical filenames with different IDs", ->
|
it "should return unique paths for identical filenames with different IDs", ->
|
||||||
f1 = new File(filename: '123.png', contentType: 'image/png', id: 'id1')
|
f1 = new File(filename: '123.png', contentType: 'image/png', id: 'id1')
|
||||||
f2 = new File(filename: '123.png', contentType: 'image/png', id: 'id2')
|
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(f1)).toBe("/Users/testuser/.nylas/downloads/id1/123.png")
|
||||||
expect(FileDownloadStore.pathForFile(f2)).toBe("/Users/bengotow/.nylas-spec/downloads/id2/123.png")
|
expect(FileDownloadStore.pathForFile(f2)).toBe("/Users/testuser/.nylas/downloads/id2/123.png")
|
||||||
|
|
||||||
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", ->
|
||||||
|
|
@ -87,7 +88,7 @@ describe "FileDownloadStore", ->
|
||||||
percent : 0,
|
percent : 0,
|
||||||
filename : '123.png',
|
filename : '123.png',
|
||||||
filesize : 100,
|
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", ->
|
describe "when the downloaded file does not exist", ->
|
||||||
|
|
@ -103,7 +104,7 @@ describe "FileDownloadStore", ->
|
||||||
percent : 0,
|
percent : 0,
|
||||||
filename : '123.png',
|
filename : '123.png',
|
||||||
filesize : 100,
|
filesize : 100,
|
||||||
targetPath : '/Users/bengotow/.nylas-spec/downloads/id/123.png'
|
targetPath : '/Users/testuser/.nylas/downloads/id/123.png'
|
||||||
})
|
})
|
||||||
|
|
||||||
it "should call download.run", ->
|
it "should call download.run", ->
|
||||||
|
|
@ -122,7 +123,7 @@ describe "FileDownloadStore", ->
|
||||||
percent : 0,
|
percent : 0,
|
||||||
filename : '123.png',
|
filename : '123.png',
|
||||||
filesize : 100,
|
filesize : 100,
|
||||||
targetPath : '/Users/bengotow/.nylas-spec/downloads/id/123.png'
|
targetPath : '/Users/testuser/.nylas/downloads/id/123.png'
|
||||||
})
|
})
|
||||||
|
|
||||||
describe "_fetch", ->
|
describe "_fetch", ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue