generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e83b739
commit 84b2818
Showing
1 changed file
with
133 additions
and
0 deletions.
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
projects/kit/src/lib/utils/time/tests/to-time-string.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import {toTimeString} from '../to-time-string'; | ||
|
||
describe('toTimeString', () => { | ||
describe('HH', () => { | ||
it('21', () => { | ||
expect(toTimeString({hours: '21'})).toBe('21'); | ||
}); | ||
|
||
it('1', () => { | ||
expect(toTimeString({hours: '1'})).toBe('1'); | ||
}); | ||
}); | ||
|
||
describe('HH:MM', () => { | ||
it('21:59', () => { | ||
expect(toTimeString({hours: '21', minutes: '59'})).toBe('21:59'); | ||
}); | ||
|
||
it('12:4', () => { | ||
expect(toTimeString({hours: '12', minutes: '4'})).toBe('12:4'); | ||
}); | ||
}); | ||
|
||
describe('HH:MM:SS', () => { | ||
it('21:59:23', () => { | ||
expect(toTimeString({hours: '21', minutes: '59', seconds: '23'})).toBe( | ||
'21:59:23', | ||
); | ||
}); | ||
|
||
it('01:23:5', () => { | ||
expect(toTimeString({hours: '01', minutes: '23', seconds: '5'})).toBe( | ||
'01:23:5', | ||
); | ||
}); | ||
}); | ||
|
||
describe('HH:MM:SS.MSS', () => { | ||
it('21:59:23.111', () => { | ||
expect( | ||
toTimeString({ | ||
hours: '21', | ||
minutes: '59', | ||
seconds: '23', | ||
milliseconds: '111', | ||
}), | ||
).toBe('21:59:23.111'); | ||
}); | ||
|
||
it('01:23:52.1', () => { | ||
expect( | ||
toTimeString({ | ||
hours: '01', | ||
minutes: '23', | ||
seconds: '52', | ||
milliseconds: '1', | ||
}), | ||
).toBe('01:23:52.1'); | ||
}); | ||
|
||
it('13:13:13.15', () => { | ||
expect( | ||
toTimeString({ | ||
hours: '13', | ||
minutes: '13', | ||
seconds: '13', | ||
milliseconds: '15', | ||
}), | ||
).toBe('13:13:13.15'); | ||
}); | ||
}); | ||
|
||
describe('MM:SS.MSS', () => { | ||
it('12:12.111', () => { | ||
expect( | ||
toTimeString({ | ||
minutes: '12', | ||
seconds: '12', | ||
milliseconds: '111', | ||
}), | ||
).toBe('12:12.111'); | ||
}); | ||
|
||
it('23:01.9', () => { | ||
expect( | ||
toTimeString({ | ||
minutes: '23', | ||
seconds: '01', | ||
milliseconds: '9', | ||
}), | ||
).toBe('23:01.9'); | ||
}); | ||
|
||
it('00:02.91', () => { | ||
expect( | ||
toTimeString({ | ||
minutes: '00', | ||
seconds: '02', | ||
milliseconds: '91', | ||
}), | ||
).toBe('00:02.91'); | ||
}); | ||
}); | ||
|
||
describe('SS.MSS', () => { | ||
it('12.111', () => { | ||
expect( | ||
toTimeString({ | ||
seconds: '12', | ||
milliseconds: '111', | ||
}), | ||
).toBe('12.111'); | ||
}); | ||
|
||
it('01.9', () => { | ||
expect( | ||
toTimeString({ | ||
seconds: '01', | ||
milliseconds: '9', | ||
}), | ||
).toBe('01.9'); | ||
}); | ||
|
||
it('02.91', () => { | ||
expect( | ||
toTimeString({ | ||
seconds: '02', | ||
milliseconds: '91', | ||
}), | ||
).toBe('02.91'); | ||
}); | ||
}); | ||
}); |