mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 19:26:55 +08:00
fix(specs) 🔪 more side-effect flakiness
This commit is contained in:
parent
d89887c20f
commit
f4dbd555d1
2 changed files with 5 additions and 5 deletions
|
@ -73,6 +73,8 @@ describe "ComposerView", ->
|
||||||
ComposerEditor.containerRequired = false
|
ComposerEditor.containerRequired = false
|
||||||
ComponentRegistry.register(ComposerEditor, role: "Composer:Editor")
|
ComponentRegistry.register(ComposerEditor, role: "Composer:Editor")
|
||||||
|
|
||||||
|
spyOn(Actions, 'queueTask')
|
||||||
|
spyOn(Actions, 'queueTasks')
|
||||||
spyOn(DraftStore, "isSendingDraft").andCallThrough()
|
spyOn(DraftStore, "isSendingDraft").andCallThrough()
|
||||||
spyOn(DraftEditingSession.prototype, 'changeSetCommit').andCallFake (draft) =>
|
spyOn(DraftEditingSession.prototype, 'changeSetCommit').andCallFake (draft) =>
|
||||||
@draft = draft
|
@draft = draft
|
||||||
|
|
|
@ -27,10 +27,12 @@ test_thread_starred = (new Thread).fromJSON({
|
||||||
})
|
})
|
||||||
|
|
||||||
describe "ThreadToolbarButtons", ->
|
describe "ThreadToolbarButtons", ->
|
||||||
|
beforeEach ->
|
||||||
|
spyOn Actions, "queueTask"
|
||||||
|
spyOn Actions, "queueTasks"
|
||||||
|
|
||||||
describe "Starring", ->
|
describe "Starring", ->
|
||||||
it "stars a thread if the star button is clicked and thread is unstarred", ->
|
it "stars a thread if the star button is clicked and thread is unstarred", ->
|
||||||
spyOn(Actions, 'queueTask')
|
|
||||||
starButton = ReactTestUtils.renderIntoDocument(<ToggleStarredButton items={[test_thread]}/>)
|
starButton = ReactTestUtils.renderIntoDocument(<ToggleStarredButton items={[test_thread]}/>)
|
||||||
|
|
||||||
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(starButton)
|
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(starButton)
|
||||||
|
@ -39,7 +41,6 @@ describe "ThreadToolbarButtons", ->
|
||||||
expect(Actions.queueTask.mostRecentCall.args[0].starred).toEqual(true)
|
expect(Actions.queueTask.mostRecentCall.args[0].starred).toEqual(true)
|
||||||
|
|
||||||
it "unstars a thread if the star button is clicked and thread is starred", ->
|
it "unstars a thread if the star button is clicked and thread is starred", ->
|
||||||
spyOn(Actions, 'queueTask')
|
|
||||||
starButton = ReactTestUtils.renderIntoDocument(<ToggleStarredButton items={[test_thread_starred]}/>)
|
starButton = ReactTestUtils.renderIntoDocument(<ToggleStarredButton items={[test_thread_starred]}/>)
|
||||||
|
|
||||||
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(starButton)
|
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(starButton)
|
||||||
|
@ -58,7 +59,6 @@ describe "ThreadToolbarButtons", ->
|
||||||
)
|
)
|
||||||
|
|
||||||
it "queues a task to change unread status to true", ->
|
it "queues a task to change unread status to true", ->
|
||||||
spyOn Actions, "queueTask"
|
|
||||||
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(markUnreadBtn).childNodes[0]
|
ReactTestUtils.Simulate.click ReactDOM.findDOMNode(markUnreadBtn).childNodes[0]
|
||||||
|
|
||||||
changeUnreadTask = Actions.queueTask.calls[0].args[0]
|
changeUnreadTask = Actions.queueTask.calls[0].args[0]
|
||||||
|
@ -88,7 +88,6 @@ describe "ThreadToolbarButtons", ->
|
||||||
)
|
)
|
||||||
|
|
||||||
it "queues a task to remove spam", ->
|
it "queues a task to remove spam", ->
|
||||||
spyOn(Actions, 'queueTasks')
|
|
||||||
spyOn(CategoryStore, 'getSpamCategory').andReturn(thread.categories[0])
|
spyOn(CategoryStore, 'getSpamCategory').andReturn(thread.categories[0])
|
||||||
ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(markSpamButton))
|
ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(markSpamButton))
|
||||||
{labelsToAdd, labelsToRemove} = Actions.queueTasks.mostRecentCall.args[0][0]
|
{labelsToAdd, labelsToRemove} = Actions.queueTasks.mostRecentCall.args[0][0]
|
||||||
|
@ -97,7 +96,6 @@ describe "ThreadToolbarButtons", ->
|
||||||
|
|
||||||
describe "when the thread can be moved to spam", ->
|
describe "when the thread can be moved to spam", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
spyOn(Actions, 'queueTasks')
|
|
||||||
spyOn(MailboxPerspective.prototype, 'canMoveThreadsTo').andReturn(true)
|
spyOn(MailboxPerspective.prototype, 'canMoveThreadsTo').andReturn(true)
|
||||||
thread = new Thread(id: "thread-id-lol-123", accountId: TEST_ACCOUNT_ID, categories: [])
|
thread = new Thread(id: "thread-id-lol-123", accountId: TEST_ACCOUNT_ID, categories: [])
|
||||||
markSpamButton = ReactTestUtils.renderIntoDocument(
|
markSpamButton = ReactTestUtils.renderIntoDocument(
|
||||||
|
|
Loading…
Add table
Reference in a new issue