Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Markopoulos committed Jan 23, 2025
1 parent 8bf40e3 commit b0778ef
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 4,126 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('ReefCheckSurveyCard', () => {

expect(getByRole('link', { name: 'VIEW DETAILS' })).toHaveAttribute(
'href',
`/reef_check_survey/${mockReefCheckSurvey.id}`,
`reef_check_survey/${mockReefCheckSurvey.id}`,
);
});
});

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`Homepage should render with given state from Redux store 1`] = `
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-md-6 Homepage-map-2 css-1fyyp8j-MuiGrid-root"
>
<mock-map
initialcenter="LatLng(0, 0)"
initialcenter="0,0"
initialzoom="5"
showsitetable="true"
/>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ exports[`Site registration page should render with given state from Redux store
Name
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -125,7 +125,7 @@ exports[`Site registration page should render with given state from Redux store
Organization
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -165,7 +165,7 @@ exports[`Site registration page should render with given state from Redux store
Email
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -212,7 +212,7 @@ exports[`Site registration page should render with given state from Redux store
Latitude
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -251,7 +251,7 @@ exports[`Site registration page should render with given state from Redux store
Longitude
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -290,7 +290,7 @@ exports[`Site registration page should render with given state from Redux store
Site Name
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -329,7 +329,7 @@ exports[`Site registration page should render with given state from Redux store
Depth (m)
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root Apply-root-3 MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -569,7 +569,7 @@ exports[`Site registration page should render with given state from Redux store
First Name
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -610,7 +610,7 @@ exports[`Site registration page should render with given state from Redux store
Last Name
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -651,7 +651,7 @@ exports[`Site registration page should render with given state from Redux store
Organization
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -692,7 +692,7 @@ exports[`Site registration page should render with given state from Redux store
Email Address
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -733,7 +733,7 @@ exports[`Site registration page should render with given state from Redux store
Password
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -993,7 +993,7 @@ exports[`Site registration page should render with given state from Redux store
Email Address
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down Expand Up @@ -1034,7 +1034,7 @@ exports[`Site registration page should render with given state from Redux store
Password
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-19z25op-MuiInputBase-root-MuiOutlinedInput-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1y8xqzk-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import { mockSite } from 'mocks/mockSite';
import { mockReefCheckSurvey } from 'mocks/mockReefCheckSurvey';
import { SelectedSiteState } from 'store/Sites/types';
import theme from 'layout/App/theme';
import * as navigation from 'next/navigation';
import { formatDate } from './ReefCheckSurveySummary';
import { ReefCheckSurveyViewPage } from '.';
import * as organismsTableModule from './ReefCheckSurveyOrganismsTable';
import * as substratesModule from './ReefCheckSurveySubstratesTable';

jest.mock('common/NavBar', () => 'Mock-NavBar');
jest.mock('./ReefCheckSurveyOrganismsTable');
jest.mock('./ReefCheckSurveySubstratesTable');

describe('ReefCheckSurveyViewPage', () => {
const mockStore = configureStore([]);
Expand All @@ -23,6 +26,9 @@ describe('ReefCheckSurveyViewPage', () => {
organismsTableModule,
'ReefCheckSurveyOrganismsTable',
);
const useParamsSpy = jest
.spyOn(navigation, 'useParams')
.mockReturnValue({ id: '1', sid: '1' });

const reefCheckSurveySubstratesTableSpy = jest.spyOn(
substratesModule,
Expand Down Expand Up @@ -52,6 +58,7 @@ describe('ReefCheckSurveyViewPage', () => {
afterAll(() => {
reefCheckSurveyOrganismsTableSpy.mockRestore();
reefCheckSurveySubstratesTableSpy.mockRestore();
useParamsSpy.mockRestore();
scrollToSpy.mockRestore();
});

Expand Down
Loading

0 comments on commit b0778ef

Please sign in to comment.