diff --git a/src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts b/src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts index ca75f4f14e2..36d6a9d9020 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts @@ -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'] + }; + + // Simulate isNoneOfTheAboveEnabled being false + component.updateNoneOfTheAbove(); + + expect(component.responseDetails.answers).toEqual(['NoneOfTheAbove']); + + // Simulate isNoneOfTheAboveEnabled being true + component.responseDetails = { + answers: ['A', 'B', 'C'] + }; + + component.updateNoneOfTheAbove(); + + expect(component.responseDetails.answers).toEqual([]); + }); +});