Skip to content

Commit 20fb3ef

Browse files
krzysztof-kwittnurikk
authored andcommitted
test: add tests for AttributeEditor
1 parent 7f46ad0 commit 20fb3ef

17 files changed

+1592
-77
lines changed

.github/workflows/node.js.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,31 @@ jobs:
1616
build:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- name: 📥 Checkout Repository
20+
uses: actions/checkout@v4
2021

21-
- uses: pnpm/action-setup@v2
22-
name: Install pnpm
23-
id: pnpm-install
22+
- name: 📦 Install pnpm
23+
uses: pnpm/action-setup@v2
2424
with:
2525
version: 8
2626

27-
- name: Use Node.js
27+
- name: 🚀 Use Node.js
2828
uses: actions/setup-node@v3
2929
with:
3030
node-version: 18
3131
cache: pnpm
3232

33-
- run: pnpm install --frozen-lockfile
33+
- name: 🛠️ Install Dependencies
34+
run: pnpm install --frozen-lockfile
3435

35-
- name: Check static code analysis.
36+
- name: 🔍 Check static code analysis
3637
run: pnpm run test:eslint
3738

38-
- name: Check code style.
39+
- name: 💅 Check code style
3940
run: pnpm run test:pretty
40-
41-
- run: pnpm build
41+
42+
- name: 🧪 Run tests
43+
run: pnpm run test:unit
44+
45+
- name: 🏗️ Build production bundle
46+
run: pnpm build

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Z2M_API_URI="ws://192.168.1.200:8080" npm run start
3333
open http://localhost:3030/
3434
```
3535

36+
# Tests
37+
38+
```bash
39+
npm run test:unit
40+
```
41+
3642
# Build
3743

3844
```bash

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"postinstall": "husky install",
2121
"prepublishOnly": "pinst --disable",
2222
"postpublish": "pinst --enable",
23+
"test:unit": "vitest",
2324
"test:eslint": "eslint \"./src/**/*.{js,jsx,tsx}\"",
2425
"test:pretty": "prettier --check \"./**/*.{js,jsx,tsx}\""
2526
},
@@ -36,7 +37,9 @@
3637
"@fortawesome/fontawesome-free": "~6.4.2",
3738
"@rjsf/bootstrap-5": "https://github.com/nurikk/fileshare/blob/main/rjsf-bootstrap-5-4.2.0.tgz?raw=true",
3839
"@rjsf/core": "~4.2.3",
39-
"@toolz/local-storage": "~1.0.5",
40+
"@testing-library/jest-dom": "^6.3.0",
41+
"@testing-library/react": "^14.1.2",
42+
"@testing-library/user-event": "^14.5.2",
4043
"@types/color-convert": "~2.0.1",
4144
"@types/d3-drag": "~3.0.4",
4245
"@types/d3-force": "~3.0.6",
@@ -77,6 +80,7 @@
7780
"husky": "~8.0.3",
7881
"i18next": "~23.5.1",
7982
"i18next-browser-languagedetector": "~7.1.0",
83+
"jsdom": "^24.0.0",
8084
"jszip": "~3.10.1",
8185
"lodash": "~4.17.21",
8286
"notyf": "~3.10.0",
@@ -96,13 +100,15 @@
96100
"react-transition-group": "~4.4.5",
97101
"reconnecting-websocket": "~4.4.0",
98102
"sass": "~1.68.0",
103+
"store2": "^2.14.2",
99104
"timeago.js": "~4.0.2",
100105
"typescript": "~5.2.2",
101106
"unistore": "~3.5.2",
102107
"vite": "~4.4.10",
103108
"vite-plugin-compression": "~0.5.1",
104109
"vite-plugin-html": "~3.2.0",
105110
"vite-plugin-sass-dts": "~1.3.11",
111+
"vitest": "^1.2.1",
106112
"ws": "~8.14.2",
107113
"zigbee-herdsman": "~0.19.0",
108114
"zigbee-herdsman-converters": "~15.87.0"

0 commit comments

Comments
 (0)