mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
spec(quoted-text): Fix broken tests 😞
This commit is contained in:
parent
49fd61d347
commit
9bda66c081
|
@ -124,7 +124,7 @@ describe "ComposerView", ->
|
|||
body = @session.changes.add.calls[0].args[0].body
|
||||
expect(body).toBe """<head></head><body>Hello <strong>world</strong>#{@replyBody}</body>"""
|
||||
|
||||
describe "when sending a forwarded message message", ->
|
||||
describe "when sending a forwarded message", ->
|
||||
beforeEach ->
|
||||
@fwdBody = """<br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
|
||||
---------- Forwarded message ---------
|
||||
|
|
|
@ -12,6 +12,7 @@ requireSpecs = (specDirectory) ->
|
|||
regex = /-spec\.(coffee|js|jsx|cjsx|es6|es)$/
|
||||
|
||||
for specFilePath in fs.listTreeSync(specDirectory)
|
||||
console.log(specFilePath)
|
||||
require(specFilePath) if regex.test(specFilePath)
|
||||
|
||||
# Set spec directory on spec for setting up the project in spec-helper
|
||||
|
|
|
@ -129,14 +129,10 @@ describe('DraftFactory', function draftFactory() {
|
|||
|
||||
describe("creating drafts", () => {
|
||||
describe("createDraftForReply", () => {
|
||||
it("should include quoted text", () => {
|
||||
it("should be empty string", () => {
|
||||
waitsForPromise(() => {
|
||||
return DraftFactory.createDraftForReply({thread: fakeThread, message: fakeMessage1, type: 'reply'}).then((draft) => {
|
||||
expect(draft.body.indexOf('blockquote') > 0).toBe(true);
|
||||
expect(draft.body.indexOf(fakeMessage1.body) > 0).toBe(true);
|
||||
expect(draft.body.indexOf('gmail_quote') > 0).toBe(true);
|
||||
|
||||
expect(draft.body.search(/On .+, at .+, Customer <customer@example.com> wrote/) > 0).toBe(true);
|
||||
expect(draft.body).toEqual("");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -234,14 +230,6 @@ describe('DraftFactory', function draftFactory() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should only include the sender's name if it was available", () => {
|
||||
waitsForPromise(() => {
|
||||
return DraftFactory.createDraftForReply({thread: fakeThread, message: fakeMessage2, type: 'reply'}).then((draft) => {
|
||||
expect(draft.body.search(/On .+, at .+, ben@nylas.com wrote:/) > 0).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("type: reply", () => {
|
||||
|
|
|
@ -16,7 +16,6 @@ describe('DraftHelpers', function describeBlock() {
|
|||
const draft = new Message({
|
||||
clientId: "local-123",
|
||||
threadId: "thread-123",
|
||||
replyToMessageId: "message-123",
|
||||
uploads: ['stub'],
|
||||
});
|
||||
const session = {
|
||||
|
|
|
@ -114,7 +114,7 @@ export function prepareDraftForSyncback(session) {
|
|||
return session.ensureCorrectAccount({noSyncback: true})
|
||||
.then(() => applyExtensionTransformsToDraft(session.draft()))
|
||||
.then((transformed) => {
|
||||
if (!shouldAppendQuotedText(transformed)) {
|
||||
if (!transformed.replyToMessageId || !shouldAppendQuotedText(transformed)) {
|
||||
return Promise.resolve(transformed)
|
||||
}
|
||||
return appendQuotedTextToDraft(transformed)
|
||||
|
|
Loading…
Reference in a new issue