Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Markopoulos committed Nov 29, 2024
1 parent 2d6aa60 commit cf1f81c
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 196 deletions.
3 changes: 2 additions & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"axios": "axios/dist/node/axios.cjs",
"^csv-stringify/browser/esm/sync": "<rootDir>/../../node_modules/csv-stringify/dist/cjs/sync.cjs"
},
"globalSetup": "./src/global-setup.js"
"globalSetup": "./src/global-setup.js",
"resetMocks": false
},
"browserslist": {
"production": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ReefCheckSurveySummaryComponent = ({
formatDate(survey?.date ?? '')
)}
</Typography>
<img src={reefCheckLogo} width={180} alt="Reef Check" />
<img src={reefCheckLogo} width={180} alt="Reef Check Logo" />
</Box>
<Box className={classes.columnCenter} flexShrink={0}>
<Typography variant="h4">
Expand Down Expand Up @@ -104,7 +104,7 @@ export const ReefCheckSurveySummaryComponent = ({
);
};

const formatDate = (dateStr: string): string => {
export const formatDate = (dateStr: string): string => {
const date = new Date(dateStr);
return date.toLocaleTimeString([], {
year: 'numeric',
Expand Down

This file was deleted.

20 changes: 13 additions & 7 deletions packages/website/src/routes/SiteRoutes/ReefCheckSurveys/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import React, { useEffect } from 'react';
import { Box, Button, Grid, Typography } from '@material-ui/core';
import { useSelector, useDispatch } from 'react-redux';
import { Link, useParams } from 'react-router-dom';
import { Box, Button, Grid, Typography } from '@material-ui/core';
import { ArrowBack } from '@material-ui/icons';
import { reefCheckSurveyGetRequest } from 'store/ReefCheckSurveys/reefCheckSurveySlice';
import { useSelector, useDispatch } from 'react-redux';
import { siteErrorSelector, siteRequest } from 'store/Sites/selectedSiteSlice';
import NavBar from 'common/NavBar';
import { ArrowBack } from '@material-ui/icons';
import { ReefCheckSurveyOrganismsTable } from './ReefCheckSurveyOrganismsTable';
import { ReefCheckSurveySummary } from './ReefCheckSurveySummary';
import { ReefCheckSurveyDetails } from './ReefCheckSurveyDetails';
import NotFound from 'routes/NotFound';
import { fishColumns } from './colDefs/fish.colDef';
import { invertebratesColumns } from './colDefs/invertables.colDef';
import { impactColumns } from './colDefs/impact.colDef';
import { rareAnimalsColumns } from './colDefs/rareAnimals.colDef';
import { bleachingColumns } from './colDefs/bleaching.colDef';
import { reefStructureColumns } from './colDefs/reefStructure';
import { ReefCheckSurveyOrganismsTable } from './ReefCheckSurveyOrganismsTable';
import { ReefCheckSurveySummary } from './ReefCheckSurveySummary';
import { ReefCheckSurveyDetails } from './ReefCheckSurveyDetails';
import { ReefCheckSurveySubstrates } from './ReefCheckSurveySubstratesTable';

const impactRows = [
Expand All @@ -37,7 +38,12 @@ export const ReefCheckSurveyViewPage = () => {
}, [dispatch, siteId, surveyId]);

if (error) {
return <Typography>Error loading site details</Typography>;
return (
<>
<NavBar searchLocation />
<NotFound />
</>
);
}
return (
<>
Expand Down
128 changes: 64 additions & 64 deletions packages/website/src/store/ReefCheckSurveys/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Site } from 'store/Sites/types';

export interface ReefCheckSite {
id: string;
siteId: string;
siteId: number;
site?: Site;
reefName: string | null;
orientation: string | null;
Expand All @@ -17,7 +17,7 @@ export interface ReefCheckSite {
}

export interface ReefCheckOrganism {
id: string;
id: number;
date: string;
surveyId: string;
organism: string;
Expand All @@ -31,7 +31,7 @@ export interface ReefCheckOrganism {
}

export interface ReefCheckSubstrate {
id: string;
id: number;
surveyId: string;
date: string;
substrateCode: string;
Expand All @@ -52,67 +52,67 @@ export interface ReefCheckSurvey {
organisms: ReefCheckOrganism[];
substrates: ReefCheckSubstrate[];
date: string;
errors: string;
depth: number;
timeOfDayWorkBegan: string;
timeOfDayWorkEnded: string;
satelliteTemperature: number | null;
methodUsedToDetermineLocation: string;
riverMouthWidth: string;
weather: string;
airTemp: number;
waterTempAtSurface: number;
waterTempAt3M: number;
waterTempAt10M: number;
approxPopnSizeX1000: number;
horizontalVisibilityInWater: number;
bestReefArea: string;
whyWasThisSiteSelected: string;
shelteredOrExposed: string;
anyMajorStormsInLastYears: string;
whenStorms: string;
overallAnthroImpact: string;
whatKindOfImpacts: string;
siltation: string;
dynamiteFishing: string;
poisonFishing: string;
aquariumFishCollection: string;
harvestOfInvertsForFood: string;
harvestOfInvertsForCurio: string;
touristDivingSnorkeling: string;
sewagePollution: string;
industrialPollution: string;
commercialFishing: string;
liveFoodFishing: string;
artisinalRecreational: string;
otherFormsOfFishing: string;
otherFishing: string;
yachts: string;
levelOfOtherImpacts: string;
otherImpacts: string;
isSiteProtected: string;
isProtectionEnforced: string;
levelOfPoaching: string;
spearfishing: string;
bannedCommercialFishing: string;
recreationalFishing: string;
invertebrateShellCollection: string;
anchoring: string;
diving: string;
otherSpecify: string;
natureOfProtection: string;
siteComments: string;
substrateComments: string;
fishComments: string;
invertsComments: string;
commentsFromOrganismSheet: string;
grouperSize: string;
percentBleaching: string;
percentColoniesBleached: string;
percentOfEachColony: string;
suspectedDisease: string;
rareAnimalsDetails: string;
submittedBy: string;
errors: string | null;
depth: number | null;
timeOfDayWorkBegan: string | null;
timeOfDayWorkEnded: string | null;
satelliteTemperature: number | null | null;
methodUsedToDetermineLocation: string | null;
riverMouthWidth: string | null;
weather: string | null;
airTemp: number | null;
waterTempAtSurface: number | null;
waterTempAt3M: number | null;
waterTempAt10M: number | null;
approxPopnSizeX1000: number | null;
horizontalVisibilityInWater: number | null;
bestReefArea: string | null;
whyWasThisSiteSelected: string | null;
shelteredOrExposed: string | null;
anyMajorStormsInLastYears: string | null;
whenStorms: string | null;
overallAnthroImpact: string | null;
whatKindOfImpacts: string | null;
siltation: string | null;
dynamiteFishing: string | null;
poisonFishing: string | null;
aquariumFishCollection: string | null;
harvestOfInvertsForFood: string | null;
harvestOfInvertsForCurio: string | null;
touristDivingSnorkeling: string | null;
sewagePollution: string | null;
industrialPollution: string | null;
commercialFishing: string | null;
liveFoodFishing: string | null;
artisinalRecreational: string | null;
otherFormsOfFishing: string | null;
otherFishing: string | null;
yachts: string | null;
levelOfOtherImpacts: string | null;
otherImpacts: string | null;
isSiteProtected: string | null;
isProtectionEnforced: string | null;
levelOfPoaching: string | null;
spearfishing: string | null;
bannedCommercialFishing: string | null;
recreationalFishing: string | null;
invertebrateShellCollection: string | null;
anchoring: string | null;
diving: string | null;
otherSpecify: string | null;
natureOfProtection: string | null;
siteComments: string | null;
substrateComments: string | null;
fishComments: string | null;
invertsComments: string | null;
commentsFromOrganismSheet: string | null;
grouperSize: string | null;
percentBleaching: string | null;
percentColoniesBleached: string | null;
percentOfEachColony: string | null;
suspectedDisease: string | null;
rareAnimalsDetails: string | null;
submittedBy: string | null;
}

export interface ReefCheckSurveyState {
Expand Down

0 comments on commit cf1f81c

Please sign in to comment.