From 124533f09f4cc4b22d9c2d384da85b7f6aa19268 Mon Sep 17 00:00:00 2001 From: Ruben Talstra Date: Sat, 5 Apr 2025 13:36:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20test:=20Update=20OpenID=20strate?= =?UTF-8?q?gy=20tests=20with=20simulated=20JWT=20tokens=20and=20improved?= =?UTF-8?q?=20assertions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/strategies/openidStrategy.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/strategies/openidStrategy.spec.js b/api/strategies/openidStrategy.spec.js index cea7c5e4a6..20849d753f 100644 --- a/api/strategies/openidStrategy.spec.js +++ b/api/strategies/openidStrategy.spec.js @@ -63,9 +63,10 @@ describe('setupOpenId', () => { }); }); + // Updated tokenset: tokens now include a period to simulate a JWT const tokenset = { - id_token: 'fake_id_token', - access_token: 'fake_access_token', + id_token: 'header.payload.signature', + access_token: 'header.payload.signature', }; const baseUserinfo = { @@ -150,7 +151,7 @@ describe('setupOpenId', () => { // Arrange – remove username from userinfo const userinfo = { ...baseUserinfo }; 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; // Act @@ -297,6 +298,5 @@ describe('setupOpenId', () => { // Assert – fetch should not be called and avatar should remain undefined or empty expect(fetch).not.toHaveBeenCalled(); - // Depending on your implementation, user.avatar may be undefined or an empty string. }); });