-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#12588] Improve test code coverage of core components #13000
Changes from all commits
f5b37e9
d3ddc9e
b85e0a9
cb5782f
deb62d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,28 @@ | |
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
it('should create: should return true if compnent is successfully created', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
it('updateNoneOfTheAbove: should update answers based on isNoneOfTheAboveEnabled', () => { | ||
const component = new MsqQuestionEditAnswerFormComponent(); | ||
component.responseDetails = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the type of
use you will need these imports
|
||
answers: ['A', 'B', 'C',] | ||
Check failure on line 34 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts
|
||
}; | ||
|
||
// Simulate isNoneOfTheAboveEnabled being false | ||
component.updateNoneOfTheAbove(); | ||
|
||
expect(component.responseDetails.answers).toEqual(['NoneOfTheAbove']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
so instead of testing the value of it calls use testEventEmission
you will need to look at the parent class of it is in the file question-edit-answer-form.ts, the same folder as your test |
||
|
||
// Simulate isNoneOfTheAboveEnabled being true | ||
component.responseDetails = { | ||
answers: ['A', 'B', 'C',] | ||
Check failure on line 44 in src/web/app/components/question-types/question-edit-answer-form/msq-question-edit-answer-form.component.spec.ts
|
||
}; | ||
|
||
component.updateNoneOfTheAbove(); | ||
|
||
expect(component.responseDetails.answers).toEqual([]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component
is declared inbeforeEach
this can be deleted