mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-15 04:06:33 +01:00
🔧 test: Update OpenID strategy tests with simulated JWT tokens and improved assertions
This commit is contained in:
parent
c77d13d269
commit
124533f09f
1 changed files with 4 additions and 4 deletions
|
|
@ -63,9 +63,10 @@ describe('setupOpenId', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Updated tokenset: tokens now include a period to simulate a JWT
|
||||||
const tokenset = {
|
const tokenset = {
|
||||||
id_token: 'fake_id_token',
|
id_token: 'header.payload.signature',
|
||||||
access_token: 'fake_access_token',
|
access_token: 'header.payload.signature',
|
||||||
};
|
};
|
||||||
|
|
||||||
const baseUserinfo = {
|
const baseUserinfo = {
|
||||||
|
|
@ -150,7 +151,7 @@ describe('setupOpenId', () => {
|
||||||
// Arrange – remove username from userinfo
|
// Arrange – remove username from userinfo
|
||||||
const userinfo = { ...baseUserinfo };
|
const userinfo = { ...baseUserinfo };
|
||||||
delete userinfo.username;
|
delete userinfo.username;
|
||||||
// Expect the username to be the given name (unchanged case)
|
// Expect the username to be the given name
|
||||||
const expectUsername = userinfo.given_name;
|
const expectUsername = userinfo.given_name;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -297,6 +298,5 @@ describe('setupOpenId', () => {
|
||||||
|
|
||||||
// Assert – fetch should not be called and avatar should remain undefined or empty
|
// Assert – fetch should not be called and avatar should remain undefined or empty
|
||||||
expect(fetch).not.toHaveBeenCalled();
|
expect(fetch).not.toHaveBeenCalled();
|
||||||
// Depending on your implementation, user.avatar may be undefined or an empty string.
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue