mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(desktop): guard native OAuth parser boundary
This commit is contained in:
parent
df1f825ce7
commit
ca7659a86c
1 changed files with 13 additions and 0 deletions
|
|
@ -193,6 +193,19 @@ test('parseStoredTokenSet maps the encrypted on-disk camelCase shape', () => {
|
|||
assert.equal(t.userId, 'u-stored')
|
||||
})
|
||||
|
||||
test('parseTokenResponse cannot read a persisted set (the reload bug #73271)', () => {
|
||||
// Guards against regressing to the wrong parser on the reload path: a
|
||||
// persisted camelCase set has no snake_case access_token, so the raw-response
|
||||
// parser throws — which is exactly why the stored path must use
|
||||
// parseStoredTokenSet instead.
|
||||
const persisted = JSON.parse(
|
||||
JSON.stringify({ accessToken: 'AT', refreshToken: 'RT', expiresAt: 1, provider: 'nous', userId: 'u' })
|
||||
)
|
||||
|
||||
assert.throws(() => parseTokenResponse(persisted), /missing access_token/i)
|
||||
assert.equal(parseStoredTokenSet(persisted).accessToken, 'AT')
|
||||
})
|
||||
|
||||
test('parseStoredTokenSet rejects a non-normalized server response', () => {
|
||||
assert.throws(
|
||||
() => parseStoredTokenSet({ access_token: 'AT-server' }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue