X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/010f307346e525ac2e4239a0549d2c1a4d6d102b..a7cf03c192470cbab13edeb1aec99e0c66dede10:/src/utils/readable_time.test.js?ds=inline diff --git a/src/utils/readable_time.test.js b/src/utils/readable_time.test.js deleted file mode 100644 index 5d8ba27..0000000 --- a/src/utils/readable_time.test.js +++ /dev/null @@ -1,83 +0,0 @@ -import { readableTime } from './readable_time'; - -describe('readableTime', () => { - - test('it shows negative time as 0', () => { - - const response = readableTime(-1000); - - expect(response.count).toBe(0); - expect(response.label).toContain('seconds'); - }); - - test('uses seconds as the smallest unit', () => { - - const response = readableTime(10); - - expect(response.count).toBe(0); - expect(response.label).toContain('seconds'); - }); - - test('correctly divides miliseconds into seconds', () => { - - const response = readableTime(4000); - - expect(response.count).toBe(4); - }); - - test('uses seconds if the time is < 1 minute', () => { - - const response = readableTime(59 * 1000); - - expect(response.label).toContain('seconds'); - }); - - test('correctly divides miliseconds into minutes', () => { - - const response = readableTime(2 * 60 * 1000); - - expect(response.count).toBe(2); - }); - - test('uses minutes if the time is < 1 hour', () => { - - const response = readableTime(59 * 60 * 1000); - - expect(response.label).toContain('minutes'); - }); - - test('correctly divides miliseconds into hours', () => { - - const response = readableTime(2 * 60 * 60 * 1000); - - expect(response.count).toBe(2); - }); - - test('uses hours if the time is < 1 days', () => { - - const response = readableTime(23 * 60 * 60 * 1000); - - expect(response.label).toContain('hours'); - }); - - test('correctly divides miliseconds into days', () => { - - const response = readableTime(2 * 24 * 60 * 60 * 1000); - - expect(response.count).toBe(2); - }); - - test('uses days if the time is >= 1 day', () => { - - const response = readableTime(364 * 24 * 60 * 60 * 1000); - - expect(response.label).toContain('days'); - }); - - test('uses days as the maximum unit', () => { - - const response = readableTime(Number.MAX_VALUE); - - expect(response.label).toContain('days'); - }); -});