Skip to content

Commit 4379d10

Browse files
committed
Added more tests and husky
1 parent 252d1ae commit 4379d10

File tree

15 files changed

+36
-62
lines changed

15 files changed

+36
-62
lines changed

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
2+
git update-index --again

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint && yarn check:type && yarn test

package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,28 @@
88
"test": "jest",
99
"lint": "eslint ./src/",
1010
"check:type": "tsc --noEmit",
11-
"serve": "vite preview"
11+
"serve": "vite preview",
12+
"prepare": "husky"
1213
},
1314
"dependencies": {
1415
"@apollo/client": "^3.8.7",
1516
"@cubing/icons": "^1.0.6",
16-
"@eslint/js": "^9.26.0",
1717
"@fortawesome/fontawesome-svg-core": "^6.4.0",
1818
"@fortawesome/react-fontawesome": "^0.2.0",
1919
"@tanstack/query-sync-storage-persister": "^5.48.0",
2020
"@tanstack/react-query": "^5.48.0",
2121
"@tanstack/react-query-persist-client": "^5.48.0",
22-
"@testing-library/jest-dom": "^6.6.3",
23-
"@testing-library/react": "^13.4.0",
24-
"@testing-library/user-event": "^14.4.3",
2522
"@total-typescript/ts-reset": "^0.3.7",
26-
"@types/jest": "^29.1.2",
27-
"@types/node": "^18.8.3",
28-
"@types/react": "^18.0.21",
29-
"@types/react-dom": "^18.0.6",
30-
"@types/styled-components": "^5.1.26",
3123
"@uidotdev/usehooks": "^2.4.1",
32-
"@vitejs/plugin-react": "^4.0.3",
3324
"@wca/helpers": "^1.1.5",
3425
"classnames": "^2.3.2",
3526
"country-flag-icons": "^1.5.4",
3627
"date-fns": "^2.30.0",
37-
"eslint-config-prettier": "^10.1.5",
38-
"eslint-plugin-prettier": "^5.4.0",
3928
"graphql": "^16.8.1",
4029
"graphql-ws": "^5.14.2",
4130
"history": "^5.3.0",
4231
"i18n-js": "^4.5.1",
4332
"i18next": "^25.1.2",
44-
"jest": "^29.7.0",
4533
"lodash.flatmap": "^4.5.0",
4634
"lodash.flatten": "^4.4.0",
4735
"react": "^18.2.0",
@@ -59,9 +47,7 @@
5947
"react-tiny-popover": "^8.0.4",
6048
"styled-components": "^5.3.5",
6149
"tailwindcss": "^3.3.5",
62-
"temporal-polyfill": "^0.3.0",
6350
"typescript": "^5.8.3",
64-
"typescript-eslint": "^8.32.1",
6551
"vite": "^4.4.3",
6652
"vite-plugin-pwa": "^0.16.4",
6753
"vite-plugin-svgr": "^4.1.0",
@@ -71,22 +57,37 @@
7157
"devDependencies": {
7258
"@babel/preset-env": "^7.27.2",
7359
"@babel/preset-react": "^7.27.1",
60+
"@eslint/js": "^9.26.0",
7461
"@modyfi/vite-plugin-yaml": "^1.1.1",
7562
"@tanstack/eslint-plugin-query": "^5.47.0",
63+
"@testing-library/jest-dom": "^6.6.3",
64+
"@testing-library/react": "^13.4.0",
65+
"@testing-library/user-event": "^14.4.3",
7666
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
67+
"@types/jest": "^29.1.2",
68+
"@types/node": "^18.8.3",
69+
"@types/react": "^18.0.21",
70+
"@types/react-dom": "^18.0.6",
71+
"@types/styled-components": "^5.1.26",
72+
"@vitejs/plugin-react": "^4.0.3",
7773
"autoprefixer": "^10.4.7",
7874
"babel-jest": "^29.7.0",
7975
"eslint": "^9.26.0",
76+
"eslint-config-prettier": "^10.1.5",
77+
"eslint-plugin-prettier": "^5.4.0",
8078
"eslint-plugin-react": "^7.37.5",
8179
"eslint-plugin-react-hooks": "^5.2.0",
80+
"husky": "^9.1.7",
81+
"jest": "^29.7.0",
8282
"jest-environment-jsdom": "^29.7.0",
8383
"postcss": "^8.4.14",
8484
"prettier": "^3.5.3",
8585
"prettier-plugin-organize-imports": "^4.1.0",
8686
"react-test-renderer": "^19.1.0",
8787
"surge": "^0.23.1",
8888
"ts-jest": "^29.3.4",
89-
"ts-node": "^10.9.2"
89+
"ts-node": "^10.9.2",
90+
"typescript-eslint": "^8.32.1"
9091
},
9192
"browserslist": {
9293
"production": [

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ApolloProvider } from '@apollo/client';
22
import { useEffect } from 'react';
33
import { BrowserRouter, Routes, Route, Navigate, useParams, useNavigate } from 'react-router-dom';
44
import client from './apolloClient';
5-
import usePageTracking from './hooks/usePageTracking';
5+
import { usePageTracking } from './hooks/usePageTracking';
66
import { CompetitionLayout } from './layouts/CompetitionLayout';
77
import { RootLayout } from './layouts/RootLayout';
88
import About from './pages/About';

src/components/AssignmentLabel/__snapshots__/AssignmentLabel.test.tsx.snap

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ exports[`components/AssignmentLabel should render correctly when assignmentCode
1212
</body>
1313
`;
1414

15-
exports[`components/AssignmentLabel should render correctly when assignmentCode is "non-standard" 1`] = `
16-
<body>
17-
<div>
18-
<span
19-
class="bg-cyan-200 px-[6px] py-[4px] rounded-md bg-blue-100"
20-
>
21-
dataentry
22-
</span>
23-
</div>
24-
</body>
25-
`;
26-
2715
exports[`components/AssignmentLabel should render correctly when assignmentCode is "staff-announcer" 1`] = `
2816
<body>
2917
<div>
@@ -119,15 +107,3 @@ exports[`components/AssignmentLabel should render correctly when assignmentCode
119107
</div>
120108
</body>
121109
`;
122-
123-
exports[`components/AssignmentLabel should render correctly when assignmentCode is non-standard 1`] = `
124-
<body>
125-
<div>
126-
<span
127-
class="bg-cyan-200 px-[6px] py-[4px] rounded-md bg-blue-100"
128-
>
129-
dataentry
130-
</span>
131-
</div>
132-
</body>
133-
`;

src/containers/LiveActivities/LiveActivities.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { formatDuration, intervalToDuration } from 'date-fns';
22
import { Fragment } from 'react';
33
import { Link } from 'react-router-dom';
44
import { AssignmentCodeCell } from '@/components/AssignmentCodeCell';
5-
import { useNow } from '@/hooks/useNow';
5+
import { useNow } from '@/hooks/useNow/useNow';
66
import { useOngoingActivities } from '@/hooks/useOngoingActivities';
77
import { getAllChildActivities, getAllRoundActivities, getRooms } from '@/lib/activities';
88
import { formatTime } from '@/lib/time';

src/containers/PersonalSchedule/Assignments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Competition, Person } from '@wca/helpers';
22
import { Fragment, useEffect, useMemo } from 'react';
33
import { useTranslation } from 'react-i18next';
44
import { useCollapse } from '@/hooks/UseCollapse';
5-
import { useNow } from '@/hooks/useNow';
5+
import { useNow } from '@/hooks/useNow/useNow';
66
import { parseActivityCodeFlexible } from '@/lib/activityCodes';
77
import { isActivityWithRoomOrParent } from '@/lib/typeguards';
88
import { byDate, roundTime } from '@/lib/utils';

src/hooks/useNow/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './useNow';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './useOngoingActivities';

0 commit comments

Comments
 (0)