mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
added onBeforeUpdate listener + auto create a secret on auth enable
This commit is contained in:
@@ -19,10 +19,23 @@ describe("AppAuth", () => {
|
||||
await auth.build();
|
||||
|
||||
const config = auth.toJSON();
|
||||
expect(config.jwt.secret).toBeUndefined();
|
||||
expect(config.jwt).toBeUndefined();
|
||||
expect(config.strategies.password.config).toBeUndefined();
|
||||
});
|
||||
|
||||
test("enabling auth: generate secret", async () => {
|
||||
const auth = new AppAuth(undefined, ctx);
|
||||
await auth.build();
|
||||
|
||||
const oldConfig = auth.toJSON(true);
|
||||
//console.log(oldConfig);
|
||||
await auth.schema().patch("enabled", true);
|
||||
await auth.build();
|
||||
const newConfig = auth.toJSON(true);
|
||||
//console.log(newConfig);
|
||||
expect(newConfig.jwt.secret).not.toBe(oldConfig.jwt.secret);
|
||||
});
|
||||
|
||||
test("creates user on register", async () => {
|
||||
const auth = new AppAuth(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user