mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-14 01:04:18 +08:00
fix(build): Fix remaining specs (composer-view, send-draft-task)
This commit is contained in:
parent
39611f8962
commit
6e57cbaee4
4 changed files with 21 additions and 23 deletions
|
@ -73,7 +73,7 @@ describe "ComposerView", ->
|
|||
|
||||
@isSending = false
|
||||
spyOn(DraftStore, "isSendingDraft").andCallFake => @isSending
|
||||
spyOn(DraftEditingSession.prototype, '_changeSetCommit').andCallFake (draft) =>
|
||||
spyOn(DraftEditingSession.prototype, 'changeSetCommit').andCallFake (draft) =>
|
||||
@draft = draft
|
||||
spyOn(ContactStore, "searchContacts").andCallFake (email) =>
|
||||
return _.filter(users, (u) u.email.toLowerCase() is email.toLowerCase())
|
||||
|
|
|
@ -34,6 +34,7 @@ describe('SendDraftTask', function sendDraftTask() {
|
|||
expect(err.message).toBe("Files have been added since you started sending this draft. Double-check the draft and click 'Send' again..");
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects if no from address is specified", () => {
|
||||
const badTask = new SendDraftTask('1');
|
||||
badTask.draft = new Message({from: [],
|
||||
|
@ -255,17 +256,20 @@ describe('SendDraftTask', function sendDraftTask() {
|
|||
|
||||
this.draft.replyToMessageId = "reply-123";
|
||||
this.draft.threadId = "thread-123";
|
||||
waitsForPromise(() => this.task.performRemote(this.draft).then(() => {
|
||||
expect(NylasAPI.makeRequest).toHaveBeenCalled();
|
||||
expect(NylasAPI.makeRequest.callCount).toEqual(2);
|
||||
const req1 = NylasAPI.makeRequest.calls[0].args[0];
|
||||
const req2 = NylasAPI.makeRequest.calls[1].args[0];
|
||||
expect(req1.body.reply_to_message_id).toBe("reply-123");
|
||||
expect(req1.body.thread_id).toBe("thread-123");
|
||||
waitsForPromise(() => {
|
||||
return this.task.performRemote(this.draft)
|
||||
.then(() => {
|
||||
expect(NylasAPI.makeRequest).toHaveBeenCalled();
|
||||
expect(NylasAPI.makeRequest.callCount).toEqual(2);
|
||||
const req1 = NylasAPI.makeRequest.calls[0].args[0];
|
||||
const req2 = NylasAPI.makeRequest.calls[1].args[0];
|
||||
expect(req1.body.reply_to_message_id).toBe("reply-123");
|
||||
expect(req1.body.thread_id).toBe("thread-123");
|
||||
|
||||
expect(req2.body.reply_to_message_id).toBe(null);
|
||||
expect(req2.body.thread_id).toBe("thread-123");
|
||||
}));
|
||||
expect(req2.body.reply_to_message_id).toBe(null);
|
||||
expect(req2.body.thread_id).toBe("thread-123");
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it("retries the task if 'Invalid message public id'", () => {
|
||||
|
|
|
@ -84,9 +84,6 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
timeout: 1000 * 60 * 5, // We cannot hang up a send - won't know if it sent
|
||||
returnsModel: false,
|
||||
})
|
||||
.catch((err) => {
|
||||
this.onSendError(err, this.sendWithMultipleBodies);
|
||||
})
|
||||
.then((responseJSON) => {
|
||||
return this.createMessageFromResponse(responseJSON);
|
||||
})
|
||||
|
@ -105,8 +102,8 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
Actions.queueTask(t2);
|
||||
})
|
||||
.catch((err) => {
|
||||
return Promise.reject(err);
|
||||
});
|
||||
return this.onSendError(err, this.sendWithMultipleBodies);
|
||||
})
|
||||
}
|
||||
|
||||
// This function returns a promise that resolves to the draft when the draft has
|
||||
|
@ -120,15 +117,12 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
timeout: 1000 * 60 * 5, // We cannot hang up a send - won't know if it sent
|
||||
returnsModel: false,
|
||||
})
|
||||
.catch((err) => {
|
||||
this.onSendError(err, this.sendWithSingleBody);
|
||||
})
|
||||
.then((responseJSON) => {
|
||||
return this.createMessageFromResponse(responseJSON);
|
||||
return this.createMessageFromResponse(responseJSON)
|
||||
})
|
||||
.catch((err) => {
|
||||
return Promise.reject(err);
|
||||
});
|
||||
return this.onSendError(err, this.sendWithSingleBody);
|
||||
})
|
||||
}
|
||||
|
||||
updatePluginMetadata = () => {
|
||||
|
|
2
src/pro
2
src/pro
|
@ -1 +1 @@
|
|||
Subproject commit 04ce23e9fa17b42f0154a136536093f5c607960e
|
||||
Subproject commit 8fcfe13577d014ad4583b5f23b639047f1cb5789
|
Loading…
Reference in a new issue