mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-24 00:19:21 +00:00
chore: update tests
This commit is contained in:
@@ -1,63 +0,0 @@
|
|||||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
||||||
|
|
||||||
exports[`makeTable() > returns array of arrays with given fields 1`] = `
|
|
||||||
[
|
|
||||||
[
|
|
||||||
"Ontime · Schedule Template",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Project Title",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Project Description",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Public URL",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"Backstage URL",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
[],
|
|
||||||
[
|
|
||||||
"Time Start",
|
|
||||||
"Time End",
|
|
||||||
"Event Title",
|
|
||||||
"Presenter Name",
|
|
||||||
"Event Subtitle",
|
|
||||||
"Is Public? (x)",
|
|
||||||
"Note",
|
|
||||||
"Colour",
|
|
||||||
"End Action",
|
|
||||||
"Timer Type",
|
|
||||||
"Skip?",
|
|
||||||
"user0:test",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"00:00:00",
|
|
||||||
"00:00:00",
|
|
||||||
"test title 1",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"x",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"test",
|
|
||||||
"test",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
@@ -2,7 +2,6 @@ import { OntimeRundown, SupportedEvent } from 'ontime-types';
|
|||||||
|
|
||||||
import { dayInMs } from '../timeConstants.js';
|
import { dayInMs } from '../timeConstants.js';
|
||||||
import { getNextEvent, getPreviousEvent } from './rundownUtils';
|
import { getNextEvent, getPreviousEvent } from './rundownUtils';
|
||||||
import { calculateDuration } from './rundownUtils.js';
|
|
||||||
|
|
||||||
describe('getNextEvent()', () => {
|
describe('getNextEvent()', () => {
|
||||||
it('returns the next event of type event', () => {
|
it('returns the next event of type event', () => {
|
||||||
@@ -71,25 +70,3 @@ describe('getPreviousEvent()', () => {
|
|||||||
expect(previous).toBe(null);
|
expect(previous).toBe(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('calculateDuration()', () => {
|
|
||||||
describe('Given start and end values', () => {
|
|
||||||
it('is the difference between end and start', () => {
|
|
||||||
const duration = calculateDuration(10, 20);
|
|
||||||
expect(duration).toBe(10);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Handles edge cases', () => {
|
|
||||||
it('handles events that go over midnight', () => {
|
|
||||||
const duration = calculateDuration(51, 50);
|
|
||||||
expect(duration).toBe(dayInMs - 1);
|
|
||||||
});
|
|
||||||
it('handles no difference', () => {
|
|
||||||
const duration1 = calculateDuration(0, 0);
|
|
||||||
const duration2 = calculateDuration(dayInMs, dayInMs);
|
|
||||||
expect(duration1).toBe(0);
|
|
||||||
expect(duration2).toBe(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { EndAction, TimerType } from 'ontime-types';
|
|||||||
import { expect } from 'vitest';
|
import { expect } from 'vitest';
|
||||||
|
|
||||||
import { dayInMs } from '../timeConstants.js';
|
import { dayInMs } from '../timeConstants.js';
|
||||||
import { validateEndAction, validateTimerType, validateTimes } from './validateEvent.js';
|
import { calculateDuration, validateEndAction, validateTimerType, validateTimes } from './validateEvent.js';
|
||||||
|
|
||||||
describe('validateEndAction()', () => {
|
describe('validateEndAction()', () => {
|
||||||
it('recognises a string representation of an action', () => {
|
it('recognises a string representation of an action', () => {
|
||||||
@@ -94,3 +94,25 @@ describe('validateTimes()', () => {
|
|||||||
expect(duration).toBe(10);
|
expect(duration).toBe(10);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('calculateDuration()', () => {
|
||||||
|
describe('Given start and end values', () => {
|
||||||
|
it('is the difference between end and start', () => {
|
||||||
|
const duration = calculateDuration(10, 20);
|
||||||
|
expect(duration).toBe(10);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Handles edge cases', () => {
|
||||||
|
it('handles events that go over midnight', () => {
|
||||||
|
const duration = calculateDuration(51, 50);
|
||||||
|
expect(duration).toBe(dayInMs - 1);
|
||||||
|
});
|
||||||
|
it('handles no difference', () => {
|
||||||
|
const duration1 = calculateDuration(0, 0);
|
||||||
|
const duration2 = calculateDuration(dayInMs, dayInMs);
|
||||||
|
expect(duration1).toBe(0);
|
||||||
|
expect(duration2).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user