refactor: rename external message to secondary message

This commit is contained in:
Carlos Valente
2025-06-21 20:17:22 +02:00
committed by Carlos Valente
parent 0aeec12ccd
commit 3cd6cd2f55
18 changed files with 49 additions and 48 deletions
@@ -1,6 +1,6 @@
import { RuntimeStore } from 'ontime-types';
import * as messageService from '../MessageService.js';
import * as messageService from '../message.service.js';
describe('MessageService', () => {
let store: Partial<RuntimeStore>;
@@ -17,12 +17,12 @@ describe('MessageService', () => {
it('should patch the message state', () => {
const newState = messageService.patch({
timer: { text: 'new text', visible: true },
external: 'external',
secondary: 'secondary',
});
expect(newState).toMatchObject({
timer: { text: 'new text', visible: true, blackout: false, blink: false, secondarySource: null },
external: 'external',
secondary: 'secondary',
});
});
@@ -33,7 +33,7 @@ describe('MessageService', () => {
expect(newState).toMatchObject({
timer: { text: 'initial text', visible: true, blackout: false, blink: false, secondarySource: null },
external: '',
secondary: '',
});
});
});
@@ -1,4 +1,4 @@
import { validateMessage, validateTimerMessage } from '../messageUtils.js';
import { validateMessage, validateTimerMessage } from '../message.utils.js';
describe('validateMessage()', () => {
it('returns a valid Message object', () => {
@@ -43,7 +43,7 @@ export function patch(patch: DeepPartial<MessageState>): MessageState {
const newState = { ...getState() };
if ('timer' in patch) newState.timer = { ...newState.timer, ...patch.timer };
if ('external' in patch && patch.external !== undefined) newState.external = patch.external;
if ('secondary' in patch && patch.secondary !== undefined) newState.secondary = patch.secondary;
throttledSet('message', newState);
return newState;
@@ -33,7 +33,7 @@ export function validateTimerMessage(message: unknown): Partial<TimerMessage> {
* Asserts that the secondary value is one of the permitted values
*/
function assertSecondary(source: unknown): source is TimerMessage['secondarySource'] {
return source === 'aux' || source === 'external' || source === null;
return source === 'aux' || source === 'secondary' || source === null;
}
/**