mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
[test] genSecret
This commit is contained in:
parent
178e5cd2c0
commit
2ff7c4de5d
1 changed files with 29 additions and 2 deletions
|
@ -1,10 +1,37 @@
|
|||
const { genSecret } = require("../src/util");
|
||||
|
||||
beforeAll(() => {
|
||||
|
||||
});
|
||||
|
||||
describe("", () => {
|
||||
describe("Test genSecret", () => {
|
||||
|
||||
it("should ", () => {
|
||||
it("should be correct length", () => {
|
||||
let secret = genSecret(-1);
|
||||
expect(secret).toEqual("");
|
||||
|
||||
secret = genSecret(0);
|
||||
expect(secret).toEqual("");
|
||||
|
||||
secret = genSecret(1);
|
||||
expect(secret.length).toEqual(1);
|
||||
|
||||
secret = genSecret(2);
|
||||
expect(secret.length).toEqual(2);
|
||||
|
||||
secret = genSecret(64);
|
||||
expect(secret.length).toEqual(64);
|
||||
|
||||
secret = genSecret(9000);
|
||||
expect(secret.length).toEqual(9000);
|
||||
|
||||
secret = genSecret(90000);
|
||||
expect(secret.length).toEqual(90000);
|
||||
});
|
||||
|
||||
it("should contain first and last possible chars", () => {
|
||||
let secret = genSecret(90000);
|
||||
expect(secret).toContain("A");
|
||||
expect(secret).toContain("9");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue