fix tests for refactoring of viewer Vorgang-PIN-validation

This commit is contained in:
2025-10-30 11:15:07 +01:00
parent 793ddb17d6
commit 36273fd426

View File

@@ -27,6 +27,7 @@ describe('Vorgang Anzeige via Token', () => {
const mockRequest = {
formData: vi.fn().mockResolvedValue(formData)
};
vi.mocked(vorgangPINValidation).mockReturnValueOnce(true);
const cookiesSet = vi.fn();
@@ -39,7 +40,7 @@ describe('Vorgang Anzeige via Token', () => {
let thrownRedirect: Redirect | undefined;
try {
await actions.getVorgangByToken(event);
await actions.default(event);
} catch (e) {
thrownRedirect = e as Redirect;
}
@@ -70,9 +71,9 @@ describe('Vorgang Anzeige via Token', () => {
set: cookiesSet
}
};
const result = await actions.getVorgangByToken(event);
const result = await actions.default(event);
expect(result.status).toBe(400);
expect(result.data.message).toMatch(/fehlen|ungültig/i);
expect(result.data.message).toMatch(/PIN eingeben/i);
// Cookie wird nicht gesetzt
expect(cookiesSet).not.toHaveBeenCalled();
});