mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
refactor: normalise data (#756)
* chore: remove legal from bundle * refactor: create normalised dataset * refactor: cuesheet uses flat rundown * refactor: multi-selection * refactor: prevent stale data on server restart * refactor: increase ID size * chore: instrument operation * chore: update csv tests * fix: resolve directory to test-db (#758)
This commit is contained in:
@@ -1,28 +1,6 @@
|
||||
import { generateId } from './generateId.js';
|
||||
|
||||
test('generate a valid 5 digit id', () => {
|
||||
test('generate a valid 6 digit id', () => {
|
||||
const id = generateId();
|
||||
expect(id.length).toBe(5);
|
||||
});
|
||||
|
||||
test('generate 100 with less than 110 attempts', () => {
|
||||
const ids = new Set<string>();
|
||||
let attempts = 1;
|
||||
while (ids.size < 100) {
|
||||
ids.add(generateId());
|
||||
attempts++;
|
||||
}
|
||||
|
||||
expect(attempts).toBeLessThan(105);
|
||||
});
|
||||
|
||||
test('generate 1000 with less than 1020 attempts', () => {
|
||||
const ids = new Set<string>();
|
||||
let attempts = 1;
|
||||
while (ids.size < 1000) {
|
||||
ids.add(generateId());
|
||||
attempts++;
|
||||
}
|
||||
|
||||
expect(attempts).toBeLessThan(1020);
|
||||
expect(id.length).toBe(6);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { customAlphabet } from 'nanoid';
|
||||
|
||||
const nanoid = customAlphabet('1234567890abcdef', 5);
|
||||
const nanoid = customAlphabet('1234567890abcdef', 6);
|
||||
|
||||
/**
|
||||
* Generates a random id from the defined alphabet
|
||||
|
||||
Reference in New Issue
Block a user