mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-28 19:31:14 +08:00
fix(specs): *
This commit is contained in:
parent
b10942a4b3
commit
f316c06f7a
3 changed files with 14 additions and 11 deletions
|
@ -102,17 +102,20 @@ describe "NylasSyncWorker", ->
|
||||||
|
|
||||||
expect(@worker.resume.callCount).toBe(1)
|
expect(@worker.resume.callCount).toBe(1)
|
||||||
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(1)
|
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(1)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(2)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(2)
|
||||||
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(2)
|
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(2)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(2)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(2)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(3)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(3)
|
||||||
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(3)
|
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(3)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(3)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(3)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(4)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(3)
|
||||||
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(4)
|
||||||
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(4)
|
simulateNetworkFailure(); expect(@worker.resume.callCount).toBe(4)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(4)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(4)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(4)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(4)
|
||||||
advanceClock(30000); expect(@worker.resume.callCount).toBe(5)
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(4)
|
||||||
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(4)
|
||||||
|
advanceClock(4000); expect(@worker.resume.callCount).toBe(5)
|
||||||
|
|
||||||
it "handles the request as a failure if we try and grab labels or folders without an 'inbox'", ->
|
it "handles the request as a failure if we try and grab labels or folders without an 'inbox'", ->
|
||||||
spyOn(@worker, 'resume').andCallThrough()
|
spyOn(@worker, 'resume').andCallThrough()
|
||||||
|
|
|
@ -156,14 +156,14 @@ describe "NylasAPI", ->
|
||||||
spyOn(Actions, 'postNotification')
|
spyOn(Actions, 'postNotification')
|
||||||
NylasAPI._handleAuthenticationFailure('/threads/1234', 'token')
|
NylasAPI._handleAuthenticationFailure('/threads/1234', 'token')
|
||||||
expect(Actions.postNotification).toHaveBeenCalled()
|
expect(Actions.postNotification).toHaveBeenCalled()
|
||||||
expect(Actions.postNotification.mostRecentCall.args[0].message.trim()).toEqual("Action failed: There was an error syncing with your mail provider. You may not be able to send or receive mail.")
|
expect(Actions.postNotification.mostRecentCall.args[0].message.trim()).toEqual("A mailbox action for your mail provider could not be completed. You may not be able to send or receive mail.")
|
||||||
|
|
||||||
it "should include the email address if possible", ->
|
it "should include the email address if possible", ->
|
||||||
spyOn(AccountStore, 'tokenForAccountId').andReturn('token')
|
spyOn(AccountStore, 'tokenForAccountId').andReturn('token')
|
||||||
spyOn(Actions, 'postNotification')
|
spyOn(Actions, 'postNotification')
|
||||||
NylasAPI._handleAuthenticationFailure('/threads/1234', 'token')
|
NylasAPI._handleAuthenticationFailure('/threads/1234', 'token')
|
||||||
expect(Actions.postNotification).toHaveBeenCalled()
|
expect(Actions.postNotification).toHaveBeenCalled()
|
||||||
expect(Actions.postNotification.mostRecentCall.args[0].message.trim()).toEqual("Action failed: There was an error syncing with #{AccountStore.accounts()[0].emailAddress}. You may not be able to send or receive mail.")
|
expect(Actions.postNotification.mostRecentCall.args[0].message.trim()).toEqual("A mailbox action for #{AccountStore.accounts()[0].emailAddress} could not be completed. You may not be able to send or receive mail.")
|
||||||
|
|
||||||
describe "handleModelResponse", ->
|
describe "handleModelResponse", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
|
@ -256,7 +256,7 @@ class NylasAPI
|
||||||
type: 'error'
|
type: 'error'
|
||||||
tag: '401'
|
tag: '401'
|
||||||
sticky: true
|
sticky: true
|
||||||
message: "An mailbox action for #{email} could not be completed. You
|
message: "A mailbox action for #{email} could not be completed. You
|
||||||
may not be able to send or receive mail.",
|
may not be able to send or receive mail.",
|
||||||
icon: 'fa-sign-out'
|
icon: 'fa-sign-out'
|
||||||
actions: [{
|
actions: [{
|
||||||
|
|
Loading…
Reference in a new issue