mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
feat: export excel file
refactor: align id columns between export and import refactor: match column names with template
This commit is contained in:
committed by
Carlos Valente
parent
10762f10bf
commit
1d8c04d0b4
@@ -1,11 +1,13 @@
|
||||
import { CustomFields } from 'ontime-types';
|
||||
import { defaultImportMap, ImportMap } from 'ontime-utils';
|
||||
|
||||
import { getCustomFieldData } from '../excel.utils.js';
|
||||
import { demoDb } from '../../../models/demoProject.js';
|
||||
|
||||
import { getCustomFieldData, rundownToTabular } from '../excel.utils.js';
|
||||
|
||||
describe('getCustomFieldData()', () => {
|
||||
it('generates a list of keys from the given import map', () => {
|
||||
const importMap = {
|
||||
const importMap: ImportMap = {
|
||||
worksheet: 'event schedule',
|
||||
timeStart: 'time start',
|
||||
linkStart: 'link start',
|
||||
@@ -27,8 +29,8 @@ describe('getCustomFieldData()', () => {
|
||||
sound: 'sound',
|
||||
video: 'av',
|
||||
},
|
||||
entryId: 'id',
|
||||
} as ImportMap;
|
||||
id: 'id',
|
||||
};
|
||||
|
||||
const result = getCustomFieldData(importMap, {});
|
||||
expect(result.mergedCustomFields).toStrictEqual({
|
||||
@@ -58,7 +60,7 @@ describe('getCustomFieldData()', () => {
|
||||
});
|
||||
|
||||
it('keeps colour information from existing fields', () => {
|
||||
const importMap = {
|
||||
const importMap: ImportMap = {
|
||||
worksheet: 'event schedule',
|
||||
timeStart: 'time start',
|
||||
linkStart: 'link start',
|
||||
@@ -81,8 +83,8 @@ describe('getCustomFieldData()', () => {
|
||||
video: 'av',
|
||||
'ontime key': 'excel label',
|
||||
},
|
||||
entryId: 'id',
|
||||
} as ImportMap;
|
||||
id: 'id',
|
||||
};
|
||||
|
||||
const existingCustomFields: CustomFields = {
|
||||
lighting: { label: 'lighting', type: 'text', colour: 'red' },
|
||||
@@ -160,3 +162,13 @@ describe('getCustomFieldData()', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('rundownToTabular()', () => {
|
||||
it('returns an array of arrays describing a rundown', () => {
|
||||
const testRundown = demoDb.rundowns['default'];
|
||||
const testCustomFields = demoDb.customFields;
|
||||
|
||||
const result = rundownToTabular(testRundown, testCustomFields);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user