mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 22:24:11 +00:00
27 lines
701 B
TypeScript
27 lines
701 B
TypeScript
import { getPreviousId } from '../rundownUtils.js';
|
|
|
|
// Mock cache module
|
|
vi.mock('../rundownCache.js', () => ({
|
|
getEventOrder: () => ({
|
|
flatOrder: ['a', 'b', 'c', 'd'],
|
|
}),
|
|
}));
|
|
|
|
describe('getPreviousId', () => {
|
|
it('returns afterId if provided', () => {
|
|
expect(getPreviousId('b')).toBe('b');
|
|
});
|
|
|
|
it('returns the previous id before beforeId if provided', () => {
|
|
expect(getPreviousId(undefined, 'c')).toBe('b');
|
|
});
|
|
|
|
it('returns undefined if neither afterId nor beforeId is provided', () => {
|
|
expect(getPreviousId()).toBeUndefined();
|
|
});
|
|
|
|
it('returns undefined if beforeId is not found', () => {
|
|
expect(getPreviousId(undefined, 'z')).toBeUndefined();
|
|
});
|
|
});
|