Skip to content

Commit

Permalink
Merge branch '10434-story' into 10434-test
Browse files Browse the repository at this point in the history
  • Loading branch information
John Cruz committed Dec 12, 2024
2 parents 21bd438 + 04991a8 commit c036c5a
Showing 1 changed file with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,62 @@ describe('validateTrialSessionPlanningAction', () => {
modules: {
presenter,
},
state: {
modal: {
term: null,
year: '2001',
},
props: {
term: null,
year: '2001',
},
});
expect(errorMock).toHaveBeenCalled();

const errorCalls = errorMock.mock.calls;
expect(errorCalls.length).toEqual(1);
expect(errorCalls[0][0]).toEqual({ errors: { term: 'Select a term' } });
});

it('should return the error path if modal.year is null', () => {
runAction(validateTrialSessionPlanningAction, {
modules: {
presenter,
},
state: {
modal: {
term: 'Winter',
year: null,
},
props: {
term: 'Winter',
year: null,
},
});
expect(errorMock).toHaveBeenCalled();

const errorCalls = errorMock.mock.calls;
expect(errorCalls.length).toEqual(1);
expect(errorCalls[0][0]).toEqual({ errors: { year: 'Select a year' } });
});

it('should return the error path if both modal.year and modal.term are null', () => {
runAction(validateTrialSessionPlanningAction, {
modules: {
presenter,
},
state: {
modal: {
term: null,
year: null,
},
props: {
term: null,
year: null,
},
});

const errorCalls = errorMock.mock.calls;
expect(errorCalls.length).toEqual(1);
expect(errorCalls[0][0]).toEqual({
errors: {
term: 'Select a term',
year: 'Select a year',
},
});
expect(errorMock).toHaveBeenCalled();
});

it('should return the success path if both modal.year and modal.term are defined', () => {
runAction(validateTrialSessionPlanningAction, {
modules: {
presenter,
},
state: {
modal: {
term: 'winter',
year: '2009',
},
props: {
term: 'winter',
year: '2009',
},
});
expect(successMock).toHaveBeenCalled();
Expand Down

0 comments on commit c036c5a

Please sign in to comment.