summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/services/model/mail.spec.js
blob: 9e24a44f6603c30a2d41d23039f17a6805f71770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require(['services/model/mail'], function (Mail) {
  'use strict';

  describe('services/model/mail', function () {
    describe('parsing', function () {
      describe('a single email', function () {
        var sentMail, draftMail, receivedMail, receivedMailWithCC, rawMailWithMultipleTo, mailInTrash;
        beforeEach(function () {
          sentMail = Mail.create(Pixelated.testData().rawMail.sent);
          draftMail = Mail.create(Pixelated.testData().rawMail.draft);
          mailInTrash = Mail.create(Pixelated.testData().rawMail.trash);
          receivedMail = Mail.create(Pixelated.testData().rawMail.received);
          receivedMailWithCC = Mail.create(Pixelated.testData().rawMail.receivedWithCC);
          rawMailWithMultipleTo = Mail.create(Pixelated.testData().rawMail.rawMailWithMultipleTo);
        });

        it('correctly identifies a sent mail', function () {
          expect(sentMail.isSentMail()).toBe(true);
        });

        it('correctly identifies a draft mail', function () {
          expect(draftMail.isDraftMail()).toBe(true);
        });

        it('correctly identifies a received mail', function () {
          expect(receivedMail.isSentMail()).toBe(false);
          expect(receivedMail.isDraftMail()).toBe(false);
        });

        it('correctly identifies a mail in trash', function () {
          expect(mailInTrash.isInTrash()).toBe(true);
        });
      });

    });
  });
});