Skip to content

Commit

Permalink
hypothetically fix all failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Cohen committed Mar 8, 2024
1 parent 5be2f25 commit 1ae1706
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion functions/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export type Term =
| '202301'
| '202305'
| '202309'
| '202401';
| '202401'
| '202405';

// make const array of terms from above
export const terms: Term[] = [
Expand All @@ -29,6 +30,7 @@ export const terms: Term[] = [
'202305',
'202309',
'202401',
'202405',
];

// add some code?
Expand Down
14 changes: 7 additions & 7 deletions src/common/header/components/__tests__/TermSelect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ describe('TermSelect', () => {
render(<TermSelect />);
const termSelect = screen.getByRole('combobox') as HTMLSelectElement;

expect(termSelect.value).toStrictEqual('202305');
expect(termSelect.value).toStrictEqual('202309');
});

it('should navigate to the selected term', () => {
render(<TermSelect />);
const termSelect = screen.getByRole('combobox') as HTMLSelectElement;

const summerOption = screen.getAllByRole('option')[0];
userEvent.selectOptions(termSelect, summerOption);
expect(mockNavigate).toBeCalledWith('/calendar/202305');

const fallOption = screen.getAllByRole('option')[1];
const fallOption = screen.getAllByRole('option')[0];
userEvent.selectOptions(termSelect, fallOption);
expect(mockNavigate).toBeCalledWith('/calendar/202309');

const springOption = screen.getAllByRole('option')[2];
const springOption = screen.getAllByRole('option')[1];
userEvent.selectOptions(termSelect, springOption);
expect(mockNavigate).toBeCalledWith('/calendar/202401');

const summerOption = screen.getAllByRole('option')[2];
userEvent.selectOptions(termSelect, summerOption);
expect(mockNavigate).toBeCalledWith('/calendar/202405');
});
});
3 changes: 2 additions & 1 deletion src/lib/fetchers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export type Term =
| '202301'
| '202305'
| '202309'
| '202401';
| '202401'
| '202405';

export interface NestedPreCoRequisites {
reqList?: (NestedPreCoRequisites | KualiCourse | string)[];
Expand Down
6 changes: 3 additions & 3 deletions src/pages/calendar/components/__tests__/Requisites.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const reqNested = {

describe('DisplayRequirement', () => {
it('should render the string requirement', () => {
mockUseSessionStorage.mockReturnValue(['202305', mockSetTerm]);
mockUseSessionStorage.mockReturnValue(['202309', mockSetTerm]);
render(DisplayRequirement(reqString, 1));
expect(screen.getByTitle('Requisite')).toHaveTextContent('with a minimum GPA of 3.0 over all courses');
});

it('should render the course requirement', () => {
mockUseSessionStorage.mockReturnValue(['202305', mockSetTerm]);
mockUseSessionStorage.mockReturnValue(['202309', mockSetTerm]);
render(
DisplayRequirement(
{
Expand All @@ -42,7 +42,7 @@ describe('DisplayRequirement', () => {
});

it('should render the nested requirement', () => {
mockUseSessionStorage.mockReturnValue(['202305', mockSetTerm]);
mockUseSessionStorage.mockReturnValue(['202309', mockSetTerm]);
render(DisplayRequirement(reqNested, 1));
expect(screen.getByTitle(`${reqNested.reqList[0].subject} ${reqNested.reqList[0].code}`)).toHaveTextContent(
'PHYS 111'
Expand Down

0 comments on commit 1ae1706

Please sign in to comment.