mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 00:29:41 +00:00
fix: persistence of custom fields (#1078)
This commit is contained in:
@@ -885,7 +885,7 @@ describe('custom fields', () => {
|
||||
};
|
||||
|
||||
const customField = await editCustomField('sound', { label: 'Sound', type: 'string', colour: 'green' });
|
||||
expect(customFieldChangelog).toStrictEqual({});
|
||||
expect(customFieldChangelog).toStrictEqual(new Map());
|
||||
|
||||
expect(customField).toStrictEqual(expected);
|
||||
});
|
||||
@@ -931,9 +931,15 @@ describe('custom fields', () => {
|
||||
},
|
||||
};
|
||||
|
||||
// We need to flush all scheduled tasks for the generate function to settle
|
||||
vi.useFakeTimers();
|
||||
const customField = await editCustomField('video', { label: 'AV', type: 'string', colour: 'red' });
|
||||
expect(customField).toStrictEqual(expectedAfter);
|
||||
expect(customFieldChangelog).toStrictEqual({ video: 'av' });
|
||||
expect(customFieldChangelog).toStrictEqual(new Map([['video', 'av']]));
|
||||
await editCustomField('av', { label: 'video' });
|
||||
vi.runAllTimers();
|
||||
expect(customFieldChangelog).toStrictEqual(new Map());
|
||||
vi.useRealTimers();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -945,8 +951,8 @@ describe('custom fields', () => {
|
||||
type: 'string',
|
||||
colour: 'blue',
|
||||
},
|
||||
av: {
|
||||
label: 'AV',
|
||||
video: {
|
||||
label: 'video',
|
||||
type: 'string',
|
||||
colour: 'red',
|
||||
},
|
||||
|
||||
@@ -96,7 +96,7 @@ describe('handleCustomField()', () => {
|
||||
label: 'sound',
|
||||
},
|
||||
} as CustomFields;
|
||||
const customFieldChangelog = {};
|
||||
const customFieldChangelog = new Map<string, string>();
|
||||
|
||||
// @ts-expect-error -- partial event for testing
|
||||
const event: OntimeEvent = {
|
||||
@@ -132,9 +132,7 @@ describe('handleCustomField()', () => {
|
||||
},
|
||||
} as CustomFields;
|
||||
|
||||
const customFieldChangelog = {
|
||||
sound: 'video',
|
||||
};
|
||||
const customFieldChangelog = new Map([['sound', 'video']]);
|
||||
|
||||
// @ts-expect-error -- partial event for testing
|
||||
const event: OntimeEvent = {
|
||||
@@ -170,9 +168,7 @@ describe('handleCustomField()', () => {
|
||||
},
|
||||
} as CustomFields;
|
||||
|
||||
const customFieldChangelog = {
|
||||
field1: 'newField1',
|
||||
};
|
||||
const customFieldChangelog = new Map([['field1', 'newField1']]);
|
||||
|
||||
// @ts-expect-error -- partial event for testing
|
||||
const mutableEvent: OntimeEvent = {
|
||||
|
||||
Reference in New Issue
Block a user