fix: fix test script for forgot password
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import request from "supertest";
|
||||
import type { FastifyInstance } from "fastify";
|
||||
import { buildApp } from "../src/server";
|
||||
@@ -77,6 +77,9 @@ describe("A09 Security Logging and Monitoring Failures", () => {
|
||||
|
||||
it("emits structured security log for forgot-password requests without raw token data", async () => {
|
||||
capturedEvents.length = 0;
|
||||
const findUniqueMock = vi
|
||||
.spyOn((authApp as any).prisma.user, "findUnique")
|
||||
.mockResolvedValue(null);
|
||||
|
||||
const res = await request(authApp.server)
|
||||
.post("/auth/forgot-password/request")
|
||||
@@ -89,5 +92,6 @@ describe("A09 Security Logging and Monitoring Failures", () => {
|
||||
expect(event).toBeTruthy();
|
||||
expect(event?.outcome).toBe("success");
|
||||
expect(event && "token" in event).toBe(false);
|
||||
findUniqueMock.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user