From 9c05a84cac5e6519ef545b14ead8989719c6f612 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 5 Apr 2023 18:08:51 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../lib/utils/datetime/time_spent_utility_spec.js | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 spec/frontend/lib/utils/datetime/time_spent_utility_spec.js (limited to 'spec/frontend/lib') diff --git a/spec/frontend/lib/utils/datetime/time_spent_utility_spec.js b/spec/frontend/lib/utils/datetime/time_spent_utility_spec.js new file mode 100644 index 00000000000..15e056e45d0 --- /dev/null +++ b/spec/frontend/lib/utils/datetime/time_spent_utility_spec.js @@ -0,0 +1,25 @@ +import { formatTimeSpent } from '~/lib/utils/datetime/time_spent_utility'; + +describe('Time spent utils', () => { + describe('formatTimeSpent', () => { + describe('with limitToHours false', () => { + it('formats 34500 seconds to `1d 1h 35m`', () => { + expect(formatTimeSpent(34500)).toEqual('1d 1h 35m'); + }); + + it('formats -34500 seconds to `- 1d 1h 35m`', () => { + expect(formatTimeSpent(-34500)).toEqual('- 1d 1h 35m'); + }); + }); + + describe('with limitToHours true', () => { + it('formats 34500 seconds to `9h 35m`', () => { + expect(formatTimeSpent(34500, true)).toEqual('9h 35m'); + }); + + it('formats -34500 seconds to `- 9h 35m`', () => { + expect(formatTimeSpent(-34500, true)).toEqual('- 9h 35m'); + }); + }); + }); +}); -- cgit v1.2.3