forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMessageResult.test.js
47 lines (42 loc) · 1.56 KB
/
MessageResult.test.js
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
38
39
40
41
42
43
44
45
46
47
const { applicationContext } = require('../test/createTestApplicationContext');
const { CASE_STATUS_TYPES, PETITIONS_SECTION } = require('./EntityConstants');
const { MessageResult } = require('./MessageResult');
describe('MessageResult', () => {
const mockRawMessageResult = {
caseStatus: CASE_STATUS_TYPES.generalDocket,
caseTitle: 'The Land Before Time',
createdAt: '2019-03-01T21:40:46.415Z',
docketNumber: '123-20',
docketNumberWithSuffix: '123-45S',
from: 'Test Petitionsclerk',
fromSection: PETITIONS_SECTION,
fromUserId: '4791e892-14ee-4ab1-8468-0c942ec379d2',
isCompleted: false,
isRead: false,
isRepliedTo: false,
message: 'hey there',
messageId: 'a10d6855-f3ee-4c11-861c-c7f11cba4dff',
parentMessageId: '31687a1e-3640-42cd-8e7e-a8e6df39ce9a',
subject: 'hello',
to: 'Test Petitionsclerk2',
toSection: PETITIONS_SECTION,
toUserId: '449b916e-3362-4a5d-bf56-b2b94ba29c12',
trialDate: '2029-03-01T21:40:46.415Z',
trialLocation: 'Denver, Colorado',
};
it('should create a valid MessageResult', () => {
const messageResult = new MessageResult(mockRawMessageResult, {
applicationContext,
});
expect(messageResult.isValid()).toBeTruthy();
});
it('should fail validation when trialLocation is not one of TRIAL_CITY_STRINGS or StandaloneRemote', () => {
const messageResult = new MessageResult(
{ ...mockRawMessageResult, trialLocation: 'New Delhi, India' },
{
applicationContext,
},
);
expect(messageResult.isValid()).toBeFalsy();
});
});