Skip to content

Commit 283ba12

Browse files
authored
Validator fix, Frontend unit testing (#1733)
* Fix validators Created new patterns, Moved validators to Validate.* Fixed validators in Wizards,smtp configuration * Unit testing for web, unit tests for validators * Created Validate.any/all function. Removed logic from zod * add licenses exceptions
1 parent 2f1af6b commit 283ba12

13 files changed

Lines changed: 907 additions & 142 deletions

File tree

.github/workflows/test-web.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- dev
6+
- "release/**"
7+
paths-ignore:
8+
- "*.md"
9+
- "LICENSE"
10+
pull_request:
11+
branches:
12+
- main
13+
- dev
14+
- "release/**"
15+
paths-ignore:
16+
- "*.md"
17+
- "LICENSE"
18+
19+
jobs:
20+
test-web:
21+
runs-on:
22+
- codebuild-defguard-core-runner-${{ github.run_id }}-${{ github.run_attempt }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
submodules: "recursive"
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 24
30+
- name: install deps
31+
working-directory: ./web
32+
run: |
33+
npm i -g npm pnpm
34+
pnpm i --frozen-lockfile
35+
- name: Run tests
36+
working-directory: ./web
37+
run: pnpm run test

deny.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,34 +110,34 @@ confidence-threshold = 0.8
110110
# aren't accepted for every possible crate as with the normal allow list
111111
exceptions = [
112112
{ allow = [
113-
"AGPL-3.0-only",
113+
"AGPL-3.0-only", "AGPL-3.0-or-later",
114114
], crate = "defguard" },
115115
{ allow = [
116-
"AGPL-3.0-only",
116+
"AGPL-3.0-only", "AGPL-3.0-or-later",
117117
], crate = "defguard_common" },
118118
{ allow = [
119-
"AGPL-3.0-only",
119+
"AGPL-3.0-only", "AGPL-3.0-or-later",
120120
], crate = "defguard_core" },
121121
{ allow = [
122-
"AGPL-3.0-only",
122+
"AGPL-3.0-only", "AGPL-3.0-or-later",
123123
], crate = "defguard_mail" },
124124
{ allow = [
125-
"AGPL-3.0-only",
125+
"AGPL-3.0-only", "AGPL-3.0-or-later",
126126
], crate = "defguard_proto" },
127127
{ allow = [
128-
"AGPL-3.0-only",
128+
"AGPL-3.0-only", "AGPL-3.0-or-later",
129129
], crate = "defguard_web_ui" },
130130
{ allow = [
131-
"AGPL-3.0-only",
131+
"AGPL-3.0-only", "AGPL-3.0-or-later",
132132
], crate = "defguard_event_router" },
133133
{ allow = [
134-
"AGPL-3.0-only",
134+
"AGPL-3.0-only", "AGPL-3.0-or-later",
135135
], crate = "defguard_event_logger" },
136136
{ allow = [
137-
"AGPL-3.0-only",
137+
"AGPL-3.0-only", "AGPL-3.0-or-later",
138138
], crate = "defguard_version" },
139139
{ allow = [
140-
"AGPL-3.0-only",
140+
"AGPL-3.0-only", "AGPL-3.0-or-later",
141141
], crate = "model_derive" },
142142
]
143143

web/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"typesafe-i18n": "typesafe-i18n",
1515
"vite": "vite",
1616
"prettier": "prettier",
17-
"biome": "biome"
17+
"biome": "biome",
18+
"test": "vitest run",
19+
"test:ui": "vitest --ui",
20+
"test:watch": "vitest"
1821
},
1922
"browserslist": {
2023
"production": [
@@ -40,7 +43,10 @@
4043
],
4144
"onlyBuiltDependencies": [
4245
"@swc/core"
43-
]
46+
],
47+
"overrides": {
48+
"mdast-util-to-hast": "13.2.1"
49+
}
4450
},
4551
"dependencies": {
4652
"@floating-ui/react": "^0.27.16",
@@ -128,6 +134,7 @@
128134
"@types/react-dom": "^19.2.3",
129135
"@types/react-router-dom": "^5.3.3",
130136
"@vitejs/plugin-react-swc": "^4.2.2",
137+
"@vitest/ui": "^4.0.14",
131138
"autoprefixer": "^10.4.22",
132139
"concurrently": "^9.2.1",
133140
"dotenv": "^17.2.3",
@@ -140,6 +147,7 @@
140147
"type-fest": "^4.41.0",
141148
"typescript": "~5.9.3",
142149
"vite": "^7.2.2",
143-
"vite-plugin-package-version": "^1.1.0"
150+
"vite-plugin-package-version": "^1.1.0",
151+
"vitest": "^4.0.14"
144152
}
145153
}

0 commit comments

Comments
 (0)