mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 18:06:14 +03:00
44 lines
1 KiB
JavaScript
44 lines
1 KiB
JavaScript
const { genSecret, sleep } = require("../src/util");
|
|
|
|
describe("Test genSecret", () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
});
|
|
|
|
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");
|
|
});
|
|
|
|
});
|
|
|
|
describe("Test reset-password", () => {
|
|
it("should able to run", async () => {
|
|
await require("../extra/reset-password").main();
|
|
}, 120000);
|
|
});
|