import id's from sheet (#1516)

* import id's from sheet

* fix test

* fix test in utils

* remove comment

* ensure uri safe ids
This commit is contained in:
Alex Christoffer Rasmussen
2025-02-26 21:12:36 +01:00
committed by GitHub
parent e90161aa33
commit d0b4c6a279
6 changed files with 50 additions and 6 deletions
@@ -3,7 +3,7 @@ import { isImportMap } from '../spreadsheetImport';
describe('isImportMap()', () => {
it('validates a v3 default import map', () => {
const v3ImportMap = {
const v3ImportMap: ImportMap = {
worksheet: 'event schedule',
timeStart: 'time start',
linkStart: 'link start',
@@ -21,13 +21,38 @@ describe('isImportMap()', () => {
timeWarning: 'warning time',
timeDanger: 'danger time',
custom: {},
} as ImportMap;
entryId: 'id',
};
expect(isImportMap(v3ImportMap)).toBe(true);
});
it('rejects map missing keys', () => {
const importMap = {
worksheet: 'event schedule',
timeStart: 'time start',
linkStart: 'link start',
timeEnd: 'time end',
duration: 'duration',
cue: 'cue',
title: 'title',
countToEnd: 'count to end',
isPublic: 'public',
skip: 'skip',
note: 'notes',
colour: 'colour',
endAction: 'end action',
timerType: 'timer type',
timeWarning: 'warning time',
timeDanger: 'danger time',
custom: {},
};
expect(isImportMap(importMap)).toBe(false);
});
it('handles custom properties', () => {
const v3ImportMap = {
const v3ImportMap: ImportMap = {
worksheet: 'event schedule',
timeStart: 'time start',
linkStart: 'link start',
@@ -48,7 +73,8 @@ describe('isImportMap()', () => {
userDefined: 'userDefined',
anotherOne: 'anotherOne',
},
} as ImportMap;
entryId: 'id',
};
expect(isImportMap(v3ImportMap)).toBe(true);
});
@@ -21,6 +21,7 @@ export const defaultImportMap = {
timeWarning: 'warning time',
timeDanger: 'danger time',
custom: {},
entryId: 'id',
};
/**