Fix specs

This commit is contained in:
Juan Tejada 2016-01-28 00:48:45 -08:00
parent 3343000f86
commit f74ee7b6c2
2 changed files with 8 additions and 9 deletions

View file

@ -7,7 +7,6 @@
DraftStore,
AccountStore,
DatabaseStore,
FileUploadStore,
SoundRegistry,
SendDraftTask,
ChangeMailTask,
@ -671,7 +670,7 @@ describe "DraftStore", ->
clientId: "local-123",
threadId: "thread-123",
replyToMessageId: "message-123"
@uploads = ['stub']
uploads: ['stub']
DraftStore._draftSessions = {}
DraftStore._draftsSending = {}
@forceCommit = false
@ -688,7 +687,6 @@ describe "DraftStore", ->
spyOn(DraftStore, "_doneWithSession").andCallThrough()
spyOn(DraftStore, "trigger")
spyOn(SoundRegistry, "playSound")
spyOn(FileUploadStore, "uploadsForMessage").andReturn(@uploads)
spyOn(Actions, "queueTask")
it "plays a sound immediately when sending draft", ->
@ -765,7 +763,6 @@ describe "DraftStore", ->
task = Actions.queueTask.calls[0].args[0]
expect(task instanceof SendDraftTask).toBe true
expect(task.draft).toBe @draft
expect(task.uploads).toBe @uploads
it "queues a SendDraftTask", ->
runs ->

View file

@ -44,7 +44,9 @@ describe "SendDraftTask", ->
expect(err.message).toBe "SendDraftTask - must be provided a draft."
it "throws an error if we we don't pass uploads", ->
badTask = new SendDraftTask(new Message(), null)
message = new Message()
message.uploads = null
badTask = new SendDraftTask(message)
badTask.performLocal()
.then ->
throw new Error("Shouldn't succeed")
@ -277,8 +279,8 @@ describe "SendDraftTask", ->
subject: 'New Draft'
draft: true
body: 'hello world'
@uploads = []
@task = new SendDraftTask(@draft, @uploads)
uploads: []
@task = new SendDraftTask(@draft)
@calledBody = "ERROR: The body wasn't included!"
spyOn(DatabaseStore, "findBy").andCallFake =>
include: (body) =>
@ -317,8 +319,8 @@ describe "SendDraftTask", ->
to:
name: 'Dummy'
email: 'dummy@nylas.com'
@uploads = []
@task = new SendDraftTask(@draft, @uploads)
uploads: []
@task = new SendDraftTask(@draft)
@calledBody = "ERROR: The body wasn't included!"
spyOn(DatabaseStore, "findBy").andCallFake =>
then: -> throw new Error("You must include the body!")