Utils = require '../src/flux/models/utils' describe "quoted text", -> it "should be correct for a google calendar invite", -> body = """
Recruiting Email Weekly BlastoffTurn those cold leads into phone screens! You can make this go super fast by queueing up your drafts before hand and just sending them out during this time.
Going? | ||||||||||||||||||||||||||||||||
Invitation from Google Calendar You are receiving this email at the account ben@nilas.com because you are subscribed for invitations on calendar Ben Gotow. To stop receiving these emails, please log in to https://www.google.com/calendar/ and change your notification settings for this calendar. |
tags", -> body = """
Hi Ben
Please goto the Workspaces Console > Directories.
Then, select the Directory and "Deregister". After you deregister the Directory from Workspaces, you should then be able to goto Directory Services and remove the Directory.
Ben
""" expect(Utils.containsQuotedText(body)).toBe(false) expect(Utils.withoutQuotedText(body)).toBe(body) describe "subjectWithPrefix", -> it "should replace an existing Re:", -> expect(Utils.subjectWithPrefix("Re: Test Case", "Fwd:")).toEqual("Fwd: Test Case") it "should replace an existing re:", -> expect(Utils.subjectWithPrefix("re: Test Case", "Fwd:")).toEqual("Fwd: Test Case") it "should replace an existing Fwd:", -> expect(Utils.subjectWithPrefix("Fwd: Test Case", "Re:")).toEqual("Re: Test Case") it "should replace an existing fwd:", -> expect(Utils.subjectWithPrefix("fwd: Test Case", "Re:")).toEqual("Re: Test Case") it "should not replace Re: or Fwd: found embedded in the subject", -> expect(Utils.subjectWithPrefix("My questions are: 123", "Fwd:")).toEqual("Fwd: My questions are: 123") expect(Utils.subjectWithPrefix("My questions fwd: 123", "Fwd:")).toEqual("Fwd: My questions fwd: 123") it "should work if no existing prefix is present", -> expect(Utils.subjectWithPrefix("My questions", "Fwd:")).toEqual("Fwd: My questions")