Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Peco1503 committed Jun 15, 2024
1 parent 6c4c5d9 commit a6be3ef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/educationService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,27 @@ describe('Education Services', () => {
// Verify the method was called correctly
expect(prisma.education.findMany).toHaveBeenCalledWith();
});

test('findEducationById should return an education record', async () => {
const mockEducationId = '1';
const mockEducation = {
education_id: mockEducationId,
school: 'Tec de Monterrey',
education_degree: 'Computer Science',
gpa: 4.0,
start_date: new Date('2024-04-01'),
end_date: new Date('2027-06-01'),
relevant_coursework: 'Sample Coursework'
};

// Perform the function call
const education = await educationService.findEducationById(mockEducationId);

// Check that the returned value matches the expected mock value
expect(education).toEqual(mockEducation);
// Verify the method was called correctly
expect(prisma.education.findUnique).toHaveBeenCalledWith({
where: { education_id: mockEducationId },
});
});
});
11 changes: 11 additions & 0 deletions tests/profileService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,15 @@ describe('Profile Service Tests', () => {
where: { profile_id: profileId },
});
});

test('deleteProfile should return null if profile does not exist', async () => {
const profileId = 'profile3';

const profile = await deleteProfile(profileId);

expect(profile).toBeNull();
expect(prisma.profile.delete).toHaveBeenCalledWith({
where: { profile_id: profileId },
});
});
});

0 comments on commit a6be3ef

Please sign in to comment.