Skip to content

Commit

Permalink
added unit tests for better code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
skylar-mo committed Apr 8, 2024
1 parent 028c953 commit f5b37e9
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,26 @@ describe('MsqQuestionEditAnswerFormComponent', () => {
expect(component).toBeTruthy();
});
});

describe('updateNoneOfTheAbove', () => {
it('should update answers based on isNoneOfTheAboveEnabled', () => {
const component = new MsqQuestionEditAnswerFormComponent();
component.responseDetails = {
answers: ['A', 'B', 'C']

Check failure on line 35 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing trailing comma

Check failure on line 35 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing trailing comma
};

// Simulate isNoneOfTheAboveEnabled being false
component.updateNoneOfTheAbove();

expect(component.responseDetails.answers).toEqual(['NoneOfTheAbove']);

// Simulate isNoneOfTheAboveEnabled being true
component.responseDetails = {
answers: ['A', 'B', 'C']

Check failure on line 45 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing trailing comma

Check failure on line 45 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing trailing comma
};

component.updateNoneOfTheAbove();

expect(component.responseDetails.answers).toEqual([]);
});
});

0 comments on commit f5b37e9

Please sign in to comment.