Added StringHelpers, UniqIdGenerators and UrlParser test

UniqIdGenerators skips window.crypt test

URL tests need to be more in detail
This commit is contained in:
2025-03-07 19:01:58 +09:00
parent ea9882256e
commit 233fb6a235
8 changed files with 118 additions and 32 deletions

View File

@@ -0,0 +1,29 @@
import { describe, it, expect } from "vitest";
import {
// generateId,
randomIdF,
} from '../src/utils/UniqIdGenerators.mjs';
// window. is not defined in headless mode
// TODO: fix
/* describe("generateId", () => {
it('Should create a random id in defined length', () => {
let len_list = [
1, 12, 24, 32, 64
];
for (let len of len_list) {
expect(generateId(len)).lengthOf(len);
}
});
}); */
describe("randomIdF", () => {
it('Should create a 10 character long random id', () => {
let rand_id = randomIdF();
expect(rand_id).lengthOf(11);
expect(rand_id).match(/^[a-z0-9]{11}$/);
});
});
// __END__