Skip to content

Commit ad55812

Browse files
buslabensi94
authored andcommitted
test: align OIDC test mocks with v0.8.6-rc1 upstream
After rebasing onto v0.8.6-rc1, the cherry-picked AuthService and openIdJwtStrategy tests need updated fixtures to satisfy upstream additions: - AuthService.refreshOpenID.spec.js: mock CloudFront helpers added upstream (getCloudFrontConfig, parseCloudFrontCookieScope, setCloudFrontCookies, CLOUDFRONT_SCOPE_COOKIE) — returning empty values so tests take the cloudfront_disabled short-circuit path. - openIdJwtStrategy.spec.js: add 'iss' claim to the session-refresh test payload so upstream's stricter isOpenIdIssuerAllowed check passes before reaching the refresh logic under test.
1 parent 121111d commit ad55812

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

api/server/services/AuthService.refreshOpenID.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jest.mock('@librechat/api', () => ({
1515
math: jest.fn((val, fallback) => (val ? Number(val) : fallback)),
1616
shouldUseSecureCookie: jest.fn(() => false),
1717
resolveAppConfigForUser: jest.fn(async (_getAppConfig, _user) => ({})),
18+
getCloudFrontConfig: jest.fn(() => undefined),
19+
parseCloudFrontCookieScope: jest.fn(() => null),
20+
setCloudFrontCookies: jest.fn(),
21+
CLOUDFRONT_SCOPE_COOKIE: 'cf_scope',
1822
}));
1923
jest.mock('~/models', () => ({
2024
findUser: jest.fn(),

api/strategies/openIdJwtStrategy.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,12 @@ describe('openIdJwtStrategy – session refresh on empty session', () => {
588588
provider: 'openid',
589589
};
590590

591-
const payload = { sub: 'oidc-123', email: 'test@example.com', exp: 9999999999 };
591+
const payload = {
592+
sub: 'oidc-123',
593+
email: 'test@example.com',
594+
iss: 'https://issuer.example.com',
595+
exp: 9999999999,
596+
};
592597

593598
beforeEach(() => {
594599
jest.clearAllMocks();

0 commit comments

Comments
 (0)