test(oauth): give the pending-code fixture its password version and format the controller test

This commit is contained in:
Maurice
2026-11-26 22:32:44 +01:00
parent 19270adef8
commit 05843c8e5b
2 changed files with 9 additions and 10 deletions
@@ -135,16 +135,14 @@ describe('OauthPublicController /token', () => {
// The password changed since the consent: the code grants nothing, and the refusal is audited.
const stale = makeRes();
const staleSvc = osvc({
consumeAuthCode: vi
.fn()
.mockReturnValue({
clientId: 'c',
redirectUri: 'u',
userId: 1,
scopes: ['s'],
codeChallenge: 'cc',
resource: null,
}),
consumeAuthCode: vi.fn().mockReturnValue({
clientId: 'c',
redirectUri: 'u',
userId: 1,
scopes: ['s'],
codeChallenge: 'cc',
resource: null,
}),
authenticateClient: vi.fn().mockReturnValue({ id: 'c' }),
verifyPKCE: vi.fn().mockReturnValue(true),
issueTokensForCode: vi.fn().mockReturnValue(null),
@@ -66,6 +66,7 @@ function code(over: Partial<PendingCode> = {}): PendingCode {
resource: null,
codeChallenge: 'x',
codeChallengeMethod: 'S256',
passwordVersion: 0,
expiresAt: Date.now() + 60_000,
...over,
};