mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 19:33:46 +00:00
8c740b7111
* add dependency adding dependency to parse the excel file in the node side * import file ability to import file - add extension - safeguard file type and size * user is able to upload json or excel * chore: extract logic into self contained function * associate model with version * test id generation * parse excel data * prevent UI crash on bad data * extract validation into self contained function * chore: add more tests for bad data * config: stop from opening browser on start * fix comma in sample db * handle corrupt files * error boundary around main components * jsdocs * increase id length * parse excel time string * feat: excel parsing * validate json db before import * chore: test event validator * feat: make function to clean convert strings * chore: test parser * chore: jsdocs * fix: bug on upload prevent bug where the component would prevent upload of same file twice
21 lines
450 B
JavaScript
21 lines
450 B
JavaScript
import { generateId } from '../generate_id.js';
|
|
|
|
describe('generate a valid id', () => {
|
|
it('generates a 5 digit id', () => {
|
|
const id = generateId();
|
|
expect(id.length).toBe(5);
|
|
});
|
|
});
|
|
|
|
describe('generate 100', () => {
|
|
it('all ids are unique', () => {
|
|
let ids = [];
|
|
for (let i = 0; i < 100; i++) {
|
|
ids.push(generateId());
|
|
}
|
|
|
|
const unique = [...new Set(ids)];
|
|
expect(ids.length).toBe(unique.length);
|
|
});
|
|
});
|