mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 22:57:32 +00:00
test(oauth): give the pending-code fixture its password version and format the controller test
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user