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'])); });