Skip to content

Commit 89f4a7c

Browse files
committed
test: add test case
1 parent 2578101 commit 89f4a7c

7 files changed

Lines changed: 13616 additions & 1782 deletions

File tree

package-lock.json

Lines changed: 8165 additions & 1402 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,57 @@
2727
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
2828
"prepare": "npm run build",
2929
"watch": "tsc --watch",
30+
"test": "jest",
31+
"test:watch": "jest --watch",
32+
"test:coverage": "jest --coverage",
33+
"test:unit": "jest --testPathPattern=unit",
34+
"test:integration": "jest --testPathPattern=integration",
3035
"test-tool": "node -e \"const { generateChartByType } = require('./build/utils/generateChart'); generateChartByType('area', { dataTable: [{x:'A',y:10}], xField:'x', yField:'y', chartOutput:'image' }).then(console.log);\"",
3136
"inspector": "npx @modelcontextprotocol/inspector build/index.js"
3237
},
3338
"dependencies": {
39+
"@modelcontextprotocol/sdk": "^1.12.0",
3440
"@visactor/generate-vchart": "^2.0.7",
3541
"@visactor/vutils": "^1.0.7",
42+
"axios": "^1.10.0",
43+
"undici": "^7.11.0",
3644
"zod": "^3.25.32",
37-
"zod-to-json-schema": "^3.24.5",
38-
"@modelcontextprotocol/sdk": "^1.12.0",
39-
"axios": "^1.10.0"
45+
"zod-to-json-schema": "^3.24.5"
4046
},
4147
"devDependencies": {
48+
"@jest/globals": "^30.0.4",
4249
"@modelcontextprotocol/inspector": "^0.15.0",
50+
"@types/jest": "^29.5.12",
4351
"@types/node": "^20.11.24",
52+
"jest": "^29.7.0",
53+
"ts-jest": "^29.1.2",
4454
"typescript": "^5.3.3"
55+
},
56+
"jest": {
57+
"preset": "ts-jest",
58+
"testEnvironment": "node",
59+
"roots": [
60+
"<rootDir>/src",
61+
"<rootDir>/tests"
62+
],
63+
"testMatch": [
64+
"**/__tests__/**/*.test.ts",
65+
"**/?(*.)+(spec|test).ts"
66+
],
67+
"collectCoverageFrom": [
68+
"src/**/*.ts",
69+
"!src/**/*.d.ts",
70+
"!src/index.ts"
71+
],
72+
"coverageDirectory": "coverage",
73+
"coverageReporters": [
74+
"text",
75+
"lcov",
76+
"html"
77+
],
78+
"setupFilesAfterEnv": [
79+
"<rootDir>/tests/setup.ts"
80+
],
81+
"testTimeout": 30000
4582
}
4683
}

0 commit comments

Comments
 (0)