Skip to content

Commit

Permalink
[#12588] Add unit test for every method in recipient-type-name.pipe.s…
Browse files Browse the repository at this point in the history
…pec.ts
  • Loading branch information
ThomasGreen123 committed Oct 26, 2023
1 parent 4f053d9 commit 88ad308
Showing 1 changed file with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
import { RecipientTypeNamePipe } from './recipient-type-name.pipe';
import { FeedbackParticipantType } from '../../../types/api-output';

Check failure on line 2 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

`../../../types/api-output` import should occur before import of `./recipient-type-name.pipe`

Check failure on line 2 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

`../../../types/api-output` import should occur before import of `./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 TEAMS', () => {
expect(pipe.transform(FeedbackParticipantType.TEAMS, FeedbackParticipantType.STUDENTS)).toEqual('Team');
});

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

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

// ... you can continue with the other FeedbackParticipantTypes

describe('for OWN_TEAM_MEMBERS and OWN_TEAM_MEMBERS_INCLUDING_SELF', () => {
it('should return "Student" when giverType is STUDENTS', () => {
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS)).toEqual('Student');

Check failure on line 31 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 124. Maximum allowed is 120

Check failure on line 31 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 124. Maximum allowed is 120
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF, FeedbackParticipantType.STUDENTS)).toEqual('Student');

Check failure on line 32 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 139. Maximum allowed is 120

Check failure on line 32 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 139. Maximum allowed is 120
});

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

Check failure on line 36 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 130. Maximum allowed is 120

Check failure on line 36 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 130. Maximum allowed is 120
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF, FeedbackParticipantType.INSTRUCTORS)).toEqual('Instructor');

Check failure on line 37 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 145. Maximum allowed is 120

Check failure on line 37 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 145. Maximum allowed is 120
});

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

Check failure on line 41 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 121. Maximum allowed is 120

Check failure on line 41 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 121. Maximum allowed is 120
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF, FeedbackParticipantType.TEAMS)).toEqual('Student');

Check failure on line 42 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 136. Maximum allowed is 120

Check failure on line 42 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 136. Maximum allowed is 120
});

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

Check failure on line 46 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 135. Maximum allowed is 120

Check failure on line 46 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 135. Maximum allowed is 120
expect(pipe.transform(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF, 'ANY_OTHER_TYPE' as FeedbackParticipantType)).toEqual('Unknown');

Check failure on line 47 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

This line has a length of 150. Maximum allowed is 120

Check failure on line 47 in src/web/app/components/question-submission-form/recipient-type-name.pipe.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

This line has a length of 150. Maximum allowed is 120
});
});
});

0 comments on commit 88ad308

Please sign in to comment.