You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
631 B
31 lines
631 B
|
2 years ago
|
import { describe, expect, it } from '@jest/globals'
|
||
|
|
import secondsToTime from './secondsToTime.js'
|
||
|
|
|
||
|
|
describe('secondsToTime', () => {
|
||
|
|
it('converts seconds to an { hours, minutes, seconds } object', () => {
|
||
|
|
expect(secondsToTime(60)).toEqual({
|
||
|
|
hours: 0,
|
||
|
|
minutes: 1,
|
||
|
|
seconds: 0,
|
||
|
|
})
|
||
|
|
|
||
|
|
expect(secondsToTime(123)).toEqual({
|
||
|
|
hours: 0,
|
||
|
|
minutes: 2,
|
||
|
|
seconds: 3,
|
||
|
|
})
|
||
|
|
|
||
|
|
expect(secondsToTime(1060)).toEqual({
|
||
|
|
hours: 0,
|
||
|
|
minutes: 17,
|
||
|
|
seconds: 40,
|
||
|
|
})
|
||
|
|
|
||
|
|
expect(secondsToTime(123453460)).toEqual({
|
||
|
|
hours: 20,
|
||
|
|
minutes: 37,
|
||
|
|
seconds: 40,
|
||
|
|
})
|
||
|
|
})
|
||
|
|
})
|