Skip to content

Commit

Permalink
test: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dyudyunov committed Feb 7, 2024
1 parent 7028142 commit 3565486
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,26 @@ describe('useAdjustedGradeInputData hook', () => {
});
});
describe('onChange', () => {
it('sets modal state with event target value', () => {
const testValue = 'test-value';
it('sets modal state with event target value when it is less than possibleGrade', () => {
const testValue = possibleGrade - 1;
out.onChange({ target: { value: testValue } });
expect(setModalState).toHaveBeenCalledWith({ adjustedGradeValue: testValue });
});
it('sets modal state with event target value when it is equal to possibleGrade', () => {
const testValue = possibleGrade;
out.onChange({ target: { value: testValue } });
expect(setModalState).toHaveBeenCalledWith({ adjustedGradeValue: testValue });
});
it('sets modal state to possibleGrade when event target value is greater than possibleGrade', () => {
const testValue = possibleGrade + 1;
out.onChange({ target: { value: testValue } });
expect(setModalState).toHaveBeenCalledWith({ adjustedGradeValue: possibleGrade });
});
it('sets modal state to 0 when event target value is less than 0', () => {
const testValue = -1;
out.onChange({ target: { value: testValue } });
expect(setModalState).toHaveBeenCalledWith({ adjustedGradeValue: 0 });
});
});
});
});

0 comments on commit 3565486

Please sign in to comment.