-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from Code-Hammers/CHE-113/story/Profiles-Impr…
…ovements [CHE 113] Profiles Improvements
- Loading branch information
Showing
20 changed files
with
795 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,9 +99,30 @@ xdescribe('Profile Controller Tests', () => { | |
mockRequest = { | ||
params: { userID: '65117c94f000c9930ef5c0ee' }, | ||
body: { | ||
firstName: 'Bobby', | ||
lastName: 'Orr', | ||
availabilityForNetworking: true, | ||
careerInformation: { | ||
currentPosition: { | ||
company: 'CodeHammers', | ||
title: 'Developer', | ||
}, | ||
pastPositions: [ | ||
{ | ||
company: 'CodeHammers', | ||
title: 'Junior Developer', | ||
startDate: '2020-01-01', | ||
endDate: '2021-01-01', | ||
}, | ||
], | ||
}, | ||
cohort: 'ECRI-TEST', | ||
email: '[email protected]', | ||
gitHubProfile: 'Ghub', | ||
linkedInProfile: 'Lin', | ||
nickName: 'Johnny', | ||
personalBio: 'I love dogs!', | ||
skills: ['Javascript', 'Typescript', 'React', 'Nodejs'], | ||
socialMediaLinks: 'SMlinks', | ||
specializations: ['Javascript', 'React'], | ||
}, | ||
}; | ||
mockResponse = { | ||
|
@@ -114,9 +135,30 @@ xdescribe('Profile Controller Tests', () => { | |
it('should handle profile update', async () => { | ||
(Profile.findOneAndUpdate as jest.Mock).mockResolvedValue({ | ||
_id: '65117c94f000c9930ef5c0ee', | ||
firstName: 'Bobby', | ||
lastName: 'Orr', | ||
availabilityForNetworking: true, | ||
careerInformation: { | ||
currentPosition: { | ||
company: 'CodeHammers', | ||
title: 'Developer', | ||
}, | ||
pastPositions: [ | ||
{ | ||
company: 'CodeHammers', | ||
title: 'Junior Developer', | ||
startDate: '2020-01-01', | ||
endDate: '2021-01-01', | ||
}, | ||
], | ||
}, | ||
cohort: 'ECRI-TEST', | ||
email: '[email protected]', | ||
gitHubProfile: 'Ghub', | ||
linkedInProfile: 'Lin', | ||
nickName: 'Johnny', | ||
personalBio: 'I love dogs!', | ||
skills: ['Javascript', 'Typescript', 'React', 'Nodejs'], | ||
socialMediaLinks: 'SMlinks', | ||
specializations: ['Javascript', 'React'], | ||
}); | ||
|
||
await updateProfile(mockRequest as Request, mockResponse as Response, mockNext); | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
|
||
interface EditProfileInputProps { | ||
label: string; | ||
type: string; | ||
value: string; | ||
name: string; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void; | ||
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void; // Add onKeyDown as optional | ||
placeholder?: string; | ||
} | ||
|
||
const EditProfileInput = ({ | ||
label, | ||
type, | ||
value, | ||
name, | ||
onChange, | ||
onKeyDown, | ||
placeholder, | ||
}: EditProfileInputProps) => { | ||
return ( | ||
<div className="mb-4"> | ||
<label className="block font-bold mb-2 text-sm" htmlFor={name}> | ||
{label} | ||
</label> | ||
{type === 'textarea' ? ( | ||
<textarea | ||
className="bg-gray-800 p-2 rounded text-white w-full" | ||
id={name} | ||
name={name} | ||
value={value} | ||
onChange={onChange} | ||
style={{ maxHeight: '200px' }} | ||
maxLength={1000} | ||
/> | ||
) : ( | ||
<input | ||
className="bg-gray-800 p-2 rounded text-white w-full" | ||
id={name} | ||
name={name} | ||
type={type} | ||
value={value} | ||
onChange={onChange} | ||
onKeyDown={onKeyDown} | ||
placeholder={placeholder} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default EditProfileInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.