From 19c77d9c160ac638e7e1b340c7dae60d2ac825fa Mon Sep 17 00:00:00 2001 From: Sem Bauke Date: Fri, 30 Jan 2026 15:20:42 +0100 Subject: [PATCH] feat: add test experience for get user profile endpoint (#65593) Co-authored-by: Oliver Eyton-Williams --- api/src/routes/public/user.test.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/api/src/routes/public/user.test.ts b/api/src/routes/public/user.test.ts index 3c8b1282dc4..1366b9cdc56 100644 --- a/api/src/routes/public/user.test.ts +++ b/api/src/routes/public/user.test.ts @@ -498,7 +498,17 @@ describe('get-public-profile helpers', () => { description: 'description' } ], - experience: [], + experience: [ + { + id: 'exp1', + title: 'Developer', + company: 'Company', + location: 'Location', + startDate: '01/2020', + endDate: '12/2022', + description: 'Description' + } + ], profileUI: { isLocked: false, showAbout: true, @@ -612,6 +622,16 @@ describe('get-public-profile helpers', () => { }); }); + test('returns [] for experience if showExperience is not true', () => { + const userWithoutExperience = { + ...user, + profileUI: { ...user.profileUI, showExperience: false } + }; + expect(replacePrivateData(userWithoutExperience)).toMatchObject({ + experience: [] + }); + }); + test('returns the expected public user object if all showX flags are true', () => { expect(replacePrivateData(user)).toEqual(omit(user, ['id', 'profileUI'])); });