| Total Complexity | 8 |
| Complexity/F | 0 |
| Lines of Code | 23 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import ScheduleClosePollFormCard from '../../src/cards/ScheduleClosePollFormCard'; |
||
| 2 | import {dummyAutoclosePollState, dummyLocalTimezone, dummyPollState} from '../dummy'; |
||
| 3 | |||
| 4 | describe('ScheduleClosePollFormCard', () => { |
||
| 5 | it('should crate form without any schedule time info', () => { |
||
| 6 | const card = new ScheduleClosePollFormCard(dummyPollState, dummyLocalTimezone).create(); |
||
| 7 | expect(card.header.title).toBe('Schedule Close Poll'); |
||
| 8 | expect(card.header.subtitle).toBe('You can schedule the poll to close here.'); |
||
| 9 | // since not scheduled, the schedule info should undefined |
||
| 10 | expect(card.sections!.find((section) => section.widgets?.[0]?.decoratedText?.startIcon?.knownIcon === 'CLOCK')). |
||
| 11 | toBeUndefined(); |
||
| 12 | expect(JSON.stringify(card)).toContain('Create Schedule Close'); |
||
| 13 | }); |
||
| 14 | it('should crate form with correct state', () => { |
||
| 15 | const card = new ScheduleClosePollFormCard(dummyAutoclosePollState, dummyLocalTimezone).create(); |
||
| 16 | const result = card.sections!.find( |
||
| 17 | (section) => section.widgets?.[0]?.decoratedText?.startIcon?.knownIcon === 'CLOCK'); |
||
| 18 | expect(result).toBeDefined(); |
||
| 19 | |||
| 20 | expect(JSON.stringify(card)).toContain('Edit Schedule Close'); |
||
| 21 | }); |
||
| 22 | }); |
||
| 23 |