Skip to content

Commit

Permalink
Create mentorshipProgram.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 4, 2024
1 parent d8c6716 commit 013d2e4
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/mentorshipProgram.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// mentorshipProgram.test.js

const MentorshipProgram = require('./mentorshipProgram'); // Assuming you have a MentorshipProgram module

describe('Mentorship Program Functionalities', () => {
let mentorshipProgram;

beforeEach(() => {
mentorshipProgram = new MentorshipProgram();
});

test('should add a mentor successfully', () => {
mentorshipProgram.addMentor('Alice Johnson', 'Investing', 'Expertin financial markets');
const mentors = mentorshipProgram.getMentors();
expect(mentors).toContainEqual(expect.objectContaining({
name: 'Alice Johnson',
expertise: 'Investing',
}));
});

test('should add a mentee successfully', () => {
mentorshipProgram.addMentee('Bob Smith', 'Finance');
const mentees = mentorshipProgram.getMentees();
expect(mentees).toContainEqual(expect.objectContaining({
name: 'Bob Smith',
interest: 'Finance',
}));
});

test('should match mentor and mentee based on expertise', () => {
mentorshipProgram.addMentor('Alice Johnson', 'Investing', 'Expert in financial markets');
mentorshipProgram.addMentee('Bob Smith', 'Finance');
const match = mentorshipProgram.matchMentorToMentee('Bob Smith');
expect(match).toEqual(expect.objectContaining({
mentor: 'Alice Johnson',
mentee: 'Bob Smith',
}));
});

test('should not match if no suitable mentor is found', () => {
mentorshipProgram.addMentee('Charlie Brown', 'Art');
const match = mentorshipProgram.matchMentorToMentee('Charlie Brown');
expect(match).toBeNull(); // Assuming no mentor available for Art
});
});

0 comments on commit 013d2e4

Please sign in to comment.