-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
752272e
commit 33bcd77
Showing
1 changed file
with
47 additions
and
2 deletions.
There are no files selected for viewing
49 changes: 47 additions & 2 deletions
49
src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts
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 |
---|---|---|
@@ -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'); | ||
}); | ||
}); |