Skip to content

Commit 88bf92b

Browse files
committed
Fixed tests
1 parent a522d80 commit 88bf92b

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,28 @@ jobs:
8383
- name: Check TypeScript 👷‍♂️
8484
run: npm run check-ts
8585

86-
# test:
87-
# name: Run Tests
88-
# needs: [install]
89-
# runs-on: ubuntu-latest
90-
# steps:
91-
# - name: Checkout ✅
92-
# uses: actions/checkout@v4
93-
# - name: Setup Node 🤖
94-
# uses: actions/setup-node@v4
95-
# with:
96-
# node-version: ${{ env.node_version }}
97-
# cache: npm
98-
# - name: Restore cache 🔮
99-
# id: cache
100-
# uses: actions/cache/restore@v4
101-
# with:
102-
# path: ./node_modules
103-
# key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }}
104-
# - name: Run Tests 🚦
105-
# run: npm run test
106-
# - name: Run Benchmark
107-
# run: npm run bench
86+
test:
87+
name: Run Tests
88+
needs: [install]
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout ✅
92+
uses: actions/checkout@v4
93+
- name: Setup Node 🤖
94+
uses: actions/setup-node@v4
95+
with:
96+
node-version: ${{ env.node_version }}
97+
cache: npm
98+
- name: Restore cache 🔮
99+
id: cache
100+
uses: actions/cache/restore@v4
101+
with:
102+
path: ./node_modules
103+
key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }}
104+
- name: Run Tests 🚦
105+
run: npm run test
106+
# - name: Run Benchmark
107+
# run: npm run bench
108108

109109
build:
110110
name: Build site

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"lint-all": "npm run check-ts && npm run eslint && npm run format && npm run knip",
2929
"lint-all-fix": "npm run eslint-fix && npm run format-fix",
3030
"prepare": "git config core.hooksPath .git-hooks",
31-
"pre-commit": "npm run lint-all"
31+
"pre-commit": "npm run lint-all && npm test"
3232
},
3333
"dependencies": {
3434
"@emotion/react": "^11.13.3",

src/pages/WordToTranslation/hooks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import {
1919
import { useGetWordProgressList } from '@/services/wordProgress/hooks';
2020
import { useGetTagList } from '@/services/tags/hooks';
2121
import { renderTags } from '@/services/tags/utils';
22-
import { useEffectOnce } from '@/hooks/useOnceEffect';
22+
import { useEffectOnce } from '@/hooks/useEffectOnce';
23+
import { useEffectNext } from '@/hooks/useEffectNext';
2324

2425
export const useWordToTranslation = () => {
2526
const { data: tagList, isLoading: isLoadingTags } = useGetTagList();
@@ -112,10 +113,9 @@ export const useWordToTranslation = () => {
112113
});
113114

114115
// Update items after changed word list
115-
useEffectOnce({
116+
useEffectNext({
116117
effect: () => setItems((state) => updateQuizItems(state, wordList!)),
117118
condition: () => !!wordList,
118-
skipFirst: true,
119119
deps: [wordList],
120120
});
121121

src/setupTests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Settings } from 'luxon';
66
import { afterAll, afterEach, beforeAll, vi } from 'vitest';
77
import { setupMatchers } from './test-utils/matchers';
88
import { server } from './test-utils/msw/server';
9-
import './i18n';
109

1110
setupMatchers();
1211

0 commit comments

Comments
 (0)