mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
refactor: rename external message to secondary message
This commit is contained in:
committed by
Carlos Valente
parent
0aeec12ccd
commit
3cd6cd2f55
+4
-4
@@ -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
-1
@@ -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', () => {
|
||||
+1
-1
@@ -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;
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user