Test time conductor history 4287 (#4321)

Added some extra test for the new implementation of Time Conductor History on PR 4287
* Refractor on testing and Time Conductor
* Update duration.js
Refractor on getPreciseDuration()
This commit is contained in:
Jon Ander Oribe
2021-10-22 21:21:28 +02:00
committed by GitHub
parent 0249ab4df5
commit 5eaf222f88
2 changed files with 26 additions and 16 deletions

View File

@ -21,6 +21,7 @@
*****************************************************************************/
import {createMouseEvent, createOpenMct, resetApplicationState} from "utils/testing";
import {millisecondsToDHMS, getPreciseDuration} from "../../utils/duration";
import ConductorPlugin from "./plugin";
import Vue from 'vue';
@ -126,3 +127,19 @@ describe('time conductor', () => {
});
});
describe('duration functions', () => {
it('should transform milliseconds to DHMS', () => {
const functionResults = [millisecondsToDHMS(0), millisecondsToDHMS(86400000),
millisecondsToDHMS(129600000), millisecondsToDHMS(661824000)];
const validResults = [' ', '+ 1d', '+ 1d 12h', '+ 7d 15h 50m 24s'];
expect(validResults).toEqual(functionResults);
});
it('should get precise duration', () => {
const functionResults = [getPreciseDuration(0), getPreciseDuration(643680000),
getPreciseDuration(1605312000)];
const validResults = ['00:00:00:00', '07:10:48:00', '18:13:55:12'];
expect(validResults).toEqual(functionResults);
});
});