deno.land / x / dayjs@v1.11.5 / test / utils.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
import Utils from '../src/utils'
const prettyUnit = Utils.pconst padStart = Utils.sconst padZoneStr = Utils.z
it('PrettyUnit', () => { expect(prettyUnit('Days')).toBe('day') expect(prettyUnit('days')).toBe('day') expect(prettyUnit('day')).toBe('day') expect(prettyUnit('quarter')).toBe('quarter') expect(prettyUnit('quarters')).toBe('quarter') expect(prettyUnit('D')).toBe('date') expect(prettyUnit('d')).toBe('day') expect(prettyUnit('M')).toBe('month') expect(prettyUnit('y')).toBe('year') expect(prettyUnit('h')).toBe('hour') expect(prettyUnit('m')).toBe('minute') expect(prettyUnit('s')).toBe('second') expect(prettyUnit('ms')).toBe('millisecond') expect(prettyUnit('Q')).toBe('quarter') expect(prettyUnit()).toBe('')})
it('PadZoneStr', () => { const instance = {} instance.utcOffset = () => 0 * -1 expect(padZoneStr(instance)).toBe('+00:00') instance.utcOffset = () => 1 * 60 * -1 expect(padZoneStr(instance)).toBe('-01:00') instance.utcOffset = () => -1 * 60 * -1 expect(padZoneStr(instance)).toBe('+01:00') instance.utcOffset = () => -10 * 60 * -1 expect(padZoneStr(instance)).toBe('+10:00') instance.utcOffset = () => 10 * 60 * -1 expect(padZoneStr(instance)).toBe('-10:00') instance.utcOffset = () => ((-5 * 60) - 30) * -1 expect(padZoneStr(instance)).toBe('+05:30')})
it('PadStart', () => { expect(padStart(1, 2, '0')).toBe('01') expect(padStart(0, 2, '0')).toBe('00')})
dayjs

Version Info

Tagged at
a year ago