mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: add test experience for get user profile endpoint (#65593)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -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']));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user