Skip to content

Commit fa8f622

Browse files
committed
Add tests for changed helpers
1 parent fca1870 commit fa8f622

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

common/helpers/__tests__/dateHelperUTCFormatted.spec.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { describe, expect, it } from "vitest";
1+
import { describe, expect, it } from 'vitest'
22
import {
3+
dateLong,
34
dateRange,
5+
dateShort,
6+
dateTimeLong,
7+
hourLong,
8+
hourShort,
49
rangeLongEnd,
510
rangeShort,
611
timeDurationShort,
@@ -95,3 +100,16 @@ describe('dateRange', () => {
95100
).toEqual('Tu 1.1. - We 01/02/2019')
96101
})
97102
})
103+
104+
describe.each([
105+
['dateShort', dateShort, 'Tu 1.1.'],
106+
['dateLong', dateLong, 'Tu 01/01/2019'],
107+
['dateTimeLong', dateTimeLong, 'Tu 01/01/2019 20:00'],
108+
['hourShort', hourShort, '20:00'],
109+
['hourLong', hourLong, '20:00']])('%s', (name, func, expected) => {
110+
it('should format dateTime', () => {
111+
expect(
112+
func('2019-01-01T20:00:00.000Z', tcMock)
113+
).toEqual(expected)
114+
})
115+
})

common/helpers/__tests__/userDisplayName.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ describe('userDisplayName', () => {
77
[{ displayName: 'test' }, 'test'],
88
[{ displayName: 'test', _meta: {} }, 'test'],
99
[{ _meta: { loading: true } }, ''],
10+
[null, ''],
11+
[undefined, ''],
1012
])('maps %p to %p', (input, expected) => {
1113
expect(userDisplayName(input)).toEqual(expected)
1214
})

0 commit comments

Comments
 (0)