feature(database-connection): Add tests for timetracking and add fallback value to max season for fetching stats
This commit is contained in:
25
backend/src/api/timeutil.spec.ts
Normal file
25
backend/src/api/timeutil.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { TimeUtil } from './timeutil';
|
||||
|
||||
describe('TimeUtil', () => {
|
||||
it('should humanize raw seconds', () => {
|
||||
// const rawTime = 12345;
|
||||
// const expected = "0d 3h 25m 45s";
|
||||
const input = {
|
||||
rawTime: [
|
||||
12345,
|
||||
123,
|
||||
4
|
||||
],
|
||||
expected: [
|
||||
"0d 3h 25m 45s",
|
||||
"0d 0h 2m 3s",
|
||||
"0d 0h 0m 4s"
|
||||
]
|
||||
};
|
||||
|
||||
for (let i = 0; i < input.rawTime.length; i++) {
|
||||
const actual = TimeUtil.humanize(input.rawTime[i]);
|
||||
expect(actual).toEqual(input.expected[i]);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user