refactor: extract time-to-end

This commit is contained in:
Carlos Valente
2024-12-15 21:25:41 +01:00
parent ed65a4db67
commit b88c2a6bd8
32 changed files with 419 additions and 248 deletions
@@ -1,7 +1,6 @@
export enum TimerType {
CountDown = 'count-down',
CountUp = 'count-up',
TimeToEnd = 'time-to-end',
Clock = 'clock',
None = 'none',
}
@@ -29,6 +29,7 @@ export type OntimeEvent = OntimeBaseEvent & {
note: string;
endAction: EndAction;
timerType: TimerType;
isTimeToEnd: boolean;
linkStart: MaybeString; // ID of event to link to
timeStrategy: TimeStrategy;
timeStart: number;
@@ -18,8 +18,8 @@ describe('validateEndAction()', () => {
describe('validateTimerType()', () => {
it('recognises a string representation of an action', () => {
const timerType = validateTimerType('time-to-end');
expect(timerType).toBe(TimerType.TimeToEnd);
const timerType = validateTimerType('count-up');
expect(timerType).toBe(TimerType.CountUp);
});
it('returns fallback otherwise', () => {
const emptyType = validateTimerType('', TimerType.Clock);