Added StringHelpers, UniqIdGenerators and UrlParser test
UniqIdGenerators skips window.crypt test URL tests need to be more in detail
This commit is contained in:
29
tests/UniqIdGenerators.test.js
Normal file
29
tests/UniqIdGenerators.test.js
Normal 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__
|
||||
Reference in New Issue
Block a user