Skip to content

Commit dfc9cf7

Browse files
authored
Merge pull request #159 from olaservo/handle-empty-json-fields
Improve on tool input handling and add tests
2 parents cedf02d + c463dc5 commit dfc9cf7

File tree

13 files changed

+4197
-275
lines changed

13 files changed

+4197
-275
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
# Working around https://github.com/npm/cli/issues/4828
2626
# - run: npm ci
2727
- run: npm install --no-package-lock
28+
29+
- name: Run client tests
30+
working-directory: ./client
31+
run: npm test
32+
2833
- run: npm run build
2934

3035
publish:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ server/build
44
client/dist
55
client/tsconfig.app.tsbuildinfo
66
client/tsconfig.node.tsbuildinfo
7+
.vscode

client/jest.config.cjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "jsdom",
4+
moduleNameMapper: {
5+
"^@/(.*)$": "<rootDir>/src/$1",
6+
"^../components/DynamicJsonForm$":
7+
"<rootDir>/src/utils/__mocks__/DynamicJsonForm.ts",
8+
"^../../components/DynamicJsonForm$":
9+
"<rootDir>/src/utils/__mocks__/DynamicJsonForm.ts",
10+
},
11+
transform: {
12+
"^.+\\.tsx?$": [
13+
"ts-jest",
14+
{
15+
useESM: true,
16+
jsx: "react-jsx",
17+
tsconfig: "tsconfig.jest.json",
18+
},
19+
],
20+
},
21+
extensionsToTreatAsEsm: [".ts", ".tsx"],
22+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
23+
// Exclude directories and files that don't need to be tested
24+
testPathIgnorePatterns: [
25+
"/node_modules/",
26+
"/dist/",
27+
"/bin/",
28+
"\\.config\\.(js|ts|cjs|mjs)$",
29+
],
30+
// Exclude the same patterns from coverage reports
31+
coveragePathIgnorePatterns: [
32+
"/node_modules/",
33+
"/dist/",
34+
"/bin/",
35+
"\\.config\\.(js|ts|cjs|mjs)$",
36+
],
37+
};

client/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"dev": "vite",
1919
"build": "tsc -b && vite build",
2020
"lint": "eslint .",
21-
"preview": "vite preview"
21+
"preview": "vite preview",
22+
"test": "jest --config jest.config.cjs",
23+
"test:watch": "jest --config jest.config.cjs --watch"
2224
},
2325
"dependencies": {
2426
"@modelcontextprotocol/sdk": "^1.6.1",
@@ -35,8 +37,8 @@
3537
"clsx": "^2.1.1",
3638
"cmdk": "^1.0.4",
3739
"lucide-react": "^0.447.0",
38-
"prismjs": "^1.29.0",
3940
"pkce-challenge": "^4.1.0",
41+
"prismjs": "^1.29.0",
4042
"react": "^18.3.1",
4143
"react-dom": "^18.3.1",
4244
"react-simple-code-editor": "^0.14.1",
@@ -48,18 +50,23 @@
4850
},
4951
"devDependencies": {
5052
"@eslint/js": "^9.11.1",
53+
"@types/jest": "^29.5.14",
5154
"@types/node": "^22.7.5",
5255
"@types/react": "^18.3.10",
5356
"@types/react-dom": "^18.3.0",
5457
"@types/serve-handler": "^6.1.4",
5558
"@vitejs/plugin-react": "^4.3.2",
5659
"autoprefixer": "^10.4.20",
60+
"co": "^4.6.0",
5761
"eslint": "^9.11.1",
5862
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
5963
"eslint-plugin-react-refresh": "^0.4.12",
6064
"globals": "^15.9.0",
65+
"jest": "^29.7.0",
66+
"jest-environment-jsdom": "^29.7.0",
6167
"postcss": "^8.4.47",
6268
"tailwindcss": "^3.4.13",
69+
"ts-jest": "^29.2.6",
6370
"typescript": "^5.5.3",
6471
"typescript-eslint": "^8.7.0",
6572
"vite": "^5.4.8"

0 commit comments

Comments
 (0)