mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 00:29:41 +00:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import * as messageService from '../MessageService.js';
|
|
|
|
describe('MessageService', () => {
|
|
const publishFunction = () => {};
|
|
|
|
beforeAll(() => {
|
|
messageService.init(publishFunction);
|
|
});
|
|
|
|
beforeEach(() => {
|
|
messageService.clear();
|
|
});
|
|
|
|
it('should patch the message state', () => {
|
|
const message = {
|
|
timer: { text: 'new text', visible: true },
|
|
external: 'external',
|
|
};
|
|
|
|
const newState = messageService.patch(message);
|
|
|
|
expect(newState).toEqual({
|
|
timer: { text: 'new text', visible: true, blackout: false, blink: false, secondarySource: null },
|
|
external: 'external',
|
|
});
|
|
});
|
|
|
|
it('should not affect other properties when patching', () => {
|
|
const initialMessage = {
|
|
timer: { text: 'initial text', visible: true },
|
|
};
|
|
|
|
const newState = messageService.patch(initialMessage);
|
|
|
|
expect(newState).toEqual({
|
|
timer: { text: 'initial text', visible: true, blackout: false, blink: false, secondarySource: null },
|
|
external: '',
|
|
});
|
|
});
|
|
});
|