mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-08 07:49:12 +00:00
chore: test custom field renaming
This commit is contained in:
committed by
Carlos Valente
parent
5cf5b2fae3
commit
c4f51192de
@@ -24,6 +24,7 @@ import {
|
||||
createCustomField,
|
||||
editCustomField,
|
||||
removeCustomField,
|
||||
customFieldChangelog,
|
||||
} from '../rundownCache.js';
|
||||
|
||||
describe('generate()', () => {
|
||||
@@ -870,9 +871,56 @@ describe('custom fields', () => {
|
||||
};
|
||||
|
||||
const customField = await editCustomField('sound', { label: 'Sound', type: 'string', colour: 'green' });
|
||||
expect(customFieldChangelog).toStrictEqual({});
|
||||
|
||||
expect(customField).toStrictEqual(expected);
|
||||
});
|
||||
|
||||
it('renames a field to a new label', async () => {
|
||||
const created = await createCustomField({ label: 'Video', type: 'string', colour: 'red' });
|
||||
|
||||
const expected = {
|
||||
lighting: {
|
||||
label: 'Lighting',
|
||||
type: 'string',
|
||||
colour: 'blue',
|
||||
},
|
||||
sound: {
|
||||
label: 'Sound',
|
||||
type: 'string',
|
||||
colour: 'green',
|
||||
},
|
||||
video: {
|
||||
label: 'Video',
|
||||
type: 'string',
|
||||
colour: 'red',
|
||||
},
|
||||
};
|
||||
|
||||
expect(created).toStrictEqual(expected);
|
||||
|
||||
const expectedAfter = {
|
||||
lighting: {
|
||||
label: 'Lighting',
|
||||
type: 'string',
|
||||
colour: 'blue',
|
||||
},
|
||||
sound: {
|
||||
label: 'Sound',
|
||||
type: 'string',
|
||||
colour: 'green',
|
||||
},
|
||||
av: {
|
||||
label: 'AV',
|
||||
type: 'string',
|
||||
colour: 'red',
|
||||
},
|
||||
};
|
||||
|
||||
const customField = await editCustomField('video', { label: 'AV', type: 'string', colour: 'red' });
|
||||
expect(customField).toStrictEqual(expectedAfter);
|
||||
expect(customFieldChangelog).toStrictEqual({ video: 'av' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('removeCustomField()', () => {
|
||||
@@ -883,6 +931,11 @@ describe('custom fields', () => {
|
||||
type: 'string',
|
||||
colour: 'blue',
|
||||
},
|
||||
av: {
|
||||
label: 'AV',
|
||||
type: 'string',
|
||||
colour: 'red',
|
||||
},
|
||||
};
|
||||
|
||||
const customField = await removeCustomField('sound');
|
||||
|
||||
Reference in New Issue
Block a user