Skip to content

Commit

Permalink
[#12588] Add some unit test in recipient-type-name (#12626)
Browse files Browse the repository at this point in the history
* [#12588] Add some unit test in recipient-type-name.pipe.spec.ts

* [#12588] Add some unit test in recipient-type-name.pipe.spec.ts

* [#12588] Add some unit test in recipient-type-name.pipe.spec.ts

---------

Co-authored-by: Cedric Ong <[email protected]>
  • Loading branch information
ThomasGreen123 and cedricongjh authored Dec 2, 2023
1 parent 752272e commit 33bcd77
Showing 1 changed file with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
import { FeedbackParticipantType } from '../../../types/api-output';
import { RecipientTypeNamePipe } from './recipient-type-name.pipe';

describe('RecipientTypeNamePipe', () => {
it('create an instance', () => {
const pipe: RecipientTypeNamePipe = new RecipientTypeNamePipe();
let pipe: RecipientTypeNamePipe;

beforeEach(() => {
pipe = new RecipientTypeNamePipe();
});

it('should create an instance', () => {
expect(pipe).toBeTruthy();
});

it('should return "Team" for recipientType TEAMS', () => {
expect(pipe.transform(FeedbackParticipantType.TEAMS,
FeedbackParticipantType.STUDENTS)).toEqual('Team');
});

it('should return "Student" for recipientType STUDENTS', () => {
expect(pipe.transform(FeedbackParticipantType.STUDENTS,
FeedbackParticipantType.STUDENTS)).toEqual('Student');
});

it('should return "Instructor" for recipientType INSTRUCTORS', () => {
expect(pipe.transform(FeedbackParticipantType.INSTRUCTORS,
FeedbackParticipantType.STUDENTS)).toEqual('Instructor');
});

it('should return "Student" for OWN_TEAM_MEMBERS with giverType STUDENTS', () => {
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS,
FeedbackParticipantType.STUDENTS)).toEqual('Student');
});

it('should return "Instructor" for OWN_TEAM_MEMBERS with giverType INSTRUCTORS', () => {
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS,
FeedbackParticipantType.INSTRUCTORS)).toEqual('Instructor');
});

it('should return "Student" for OWN_TEAM_MEMBERS with giverType TEAMS', () => {
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS,
FeedbackParticipantType.TEAMS)).toEqual('Student');
});

it('should return "Unknown" for OWN_TEAM_MEMBERS with unknown giverType', () => {
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS,
'UNKNOWN' as any)).toEqual('Unknown');
});

it('should return "Unknown" for unknown recipientType', () => {
expect(pipe.transform('UNKNOWN' as any, FeedbackParticipantType.STUDENTS)).toEqual('Unknown');
});
});

0 comments on commit 33bcd77

Please sign in to comment.