tests/cards/close-poll-form.test.ts   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 0

Size

Lines of Code 23
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 18
mnd 4
bc 4
fnc 0
dl 0
loc 23
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import ClosePollFormCard from '../../src/cards/ClosePollFormCard';
2
import {dummyAnonymousPollState, dummyAutoclosePollState, dummyLocalTimezone} from '../dummy';
3
4
it('should return a schedule time info when the poll has auto schedule time ',
5
  () => {
6
    const closePollFormCard = new ClosePollFormCard(dummyAutoclosePollState, dummyLocalTimezone);
7
    const result = closePollFormCard.create();
8
    expect(result).toHaveProperty('header');
9
    expect(result).toHaveProperty('sections');
10
    // expect(result.sections).toMatchObject({'knownIcon':'CLOCK'});
11
    expect(result.sections!.find((section) => section.widgets?.[0]?.decoratedText?.startIcon?.knownIcon === 'CLOCK')).
12
      toBeDefined();
13
  });
14
it('should return a valid CardWithId object with cardId and card properties when createCardWithId method is called',
15
  () => {
16
    const closePollFormCard = new ClosePollFormCard(dummyAnonymousPollState, dummyLocalTimezone);
17
    const result = closePollFormCard.createCardWithId();
18
    expect(result).toEqual({
19
      'cardId': 'close_poll_form',
20
      'card': closePollFormCard.create(),
21
    });
22
  });
23