@elizaos/cli 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -16
- package/dist/assets/{index-CZAd5zm2.js → index-CmuPnu0u.js} +72 -89
- package/dist/assets/index-CmuPnu0u.js.br +0 -0
- package/dist/assets/index-CmuPnu0u.js.map +1 -0
- package/dist/assets/{index-CaEsCLCC.js → index-DDQnwxzL.js} +28798 -16391
- package/dist/assets/{index-CaEsCLCC.js.map → index-DDQnwxzL.js.map} +1 -1
- package/dist/assets/index-Df1AFSuJ.css +1 -0
- package/dist/assets/index-Df1AFSuJ.css.br +0 -0
- package/dist/assets/vendor-DSdxb8P-.js.map +1 -1
- package/dist/{chunk-REBZFQYE.js → chunk-7HYEGM5V.js} +967 -1597
- package/dist/{chunk-W3HS2NP6.js → chunk-B4KJXECB.js} +13 -18
- package/dist/{chunk-33BHGAF7.js → chunk-GWQB7PBK.js} +59 -32
- package/dist/{chunk-CVADLFW6.js → chunk-LQ6XHF53.js} +4543 -3043
- package/dist/{chunk-GYTAJJOD.js → chunk-RIAWNDYI.js} +16 -2
- package/dist/{chunk-IEKLJDUU.js → chunk-WS4DWCDZ.js} +54 -32
- package/dist/commands/agent/actions/index.d.ts +5 -1
- package/dist/commands/agent/actions/index.js +5 -4
- package/dist/commands/agent/index.js +3 -4
- package/dist/commands/create/actions/index.js +4 -5
- package/dist/commands/create/index.js +5 -6
- package/dist/{fileFromPath-DCRQMDLJ.js → fileFromPath-KB6XMTJ4.js} +1 -0
- package/dist/index.html +2 -2
- package/dist/index.js +9346 -102098
- package/dist/{migrator-KZLCVEIH.js → migrator-JREQPDN3.js} +42 -220
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/dist/plugin-creator-T4K2673C.js +910 -0
- package/dist/{registry-XFOSZFU4.js → registry-CBMRMYCG.js} +3 -4
- package/dist/templates/plugin-starter/README.md +255 -0
- package/dist/templates/plugin-starter/bunfig.toml +6 -0
- package/dist/templates/plugin-starter/cypress.config.ts +18 -0
- package/dist/templates/plugin-starter/index.html +13 -0
- package/dist/templates/plugin-starter/package.json +95 -0
- package/dist/templates/plugin-starter/postcss.config.js +3 -0
- package/dist/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
- package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
- package/dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/integration.test.ts +22 -17
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/plugin.test.ts +8 -8
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/test-utils.ts +17 -17
- package/dist/templates/plugin-starter/src/frontend/index.css +77 -0
- package/dist/templates/plugin-starter/src/frontend/index.tsx +164 -0
- package/dist/templates/plugin-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/plugin-starter/src/index.ts +274 -0
- package/dist/templates/plugin-starter/src/tests.ts +6 -0
- package/dist/templates/plugin-starter/tailwind.config.js +62 -0
- package/dist/templates/plugin-starter/tsconfig.build.json +11 -0
- package/dist/templates/plugin-starter/tsconfig.json +28 -0
- package/dist/templates/plugin-starter/tsup.config.ts +20 -0
- package/dist/templates/plugin-starter/vite.config.ts +20 -0
- package/dist/templates/project-starter/.env.example +153 -0
- package/dist/templates/project-starter/README.md +109 -0
- package/dist/templates/project-starter/bunfig.toml +6 -0
- package/dist/templates/project-starter/cypress.config.ts +31 -0
- package/dist/templates/project-starter/index.html +13 -0
- package/dist/templates/project-starter/package.json +83 -0
- package/dist/templates/project-starter/postcss.config.js +3 -0
- package/dist/templates/project-starter/scripts/test-all.sh +101 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/actions.test.ts +6 -6
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/character.test.ts +3 -3
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/config.test.ts +18 -18
- package/dist/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
- package/dist/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
- package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
- package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
- package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/env.test.ts +2 -2
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/error-handling.test.ts +17 -17
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/events.test.ts +7 -7
- package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/integration.test.ts +25 -25
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/models.test.ts +6 -6
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/plugin.test.ts +9 -9
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/provider.test.ts +7 -7
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/routes.test.ts +3 -3
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/test-utils.ts +17 -17
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/utils/core-test-utils.ts +3 -3
- package/dist/templates/project-starter/src/frontend/index.css +77 -0
- package/dist/templates/project-starter/src/frontend/index.html +19 -0
- package/dist/templates/project-starter/src/frontend/index.tsx +98 -0
- package/dist/templates/project-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/project-starter/src/index.ts +153 -0
- package/dist/templates/project-starter/src/plugin.ts +255 -0
- package/dist/templates/project-starter/tailwind.config.js +62 -0
- package/dist/templates/project-starter/tsconfig.build.json +20 -0
- package/dist/templates/project-starter/tsconfig.json +39 -0
- package/dist/templates/project-starter/tsup.config.ts +19 -0
- package/dist/templates/project-starter/vite.config.ts +39 -0
- package/dist/templates/project-tee-starter/.dockerignore +20 -0
- package/dist/templates/project-tee-starter/.env.example +55 -0
- package/dist/templates/project-tee-starter/Dockerfile +66 -0
- package/dist/templates/project-tee-starter/GUIDE.md +235 -0
- package/dist/templates/project-tee-starter/README.md +173 -0
- package/dist/templates/project-tee-starter/__tests__/actions.test.ts +9 -0
- package/dist/templates/project-tee-starter/__tests__/character.test.ts +86 -0
- package/dist/templates/project-tee-starter/__tests__/config.test.ts +31 -0
- package/dist/templates/project-tee-starter/__tests__/env.test.ts +87 -0
- package/dist/templates/project-tee-starter/__tests__/error-handling.test.ts +30 -0
- package/dist/templates/project-tee-starter/__tests__/events.test.ts +21 -0
- package/{templates/project-starter → dist/templates/project-tee-starter}/__tests__/file-structure.test.ts +6 -6
- package/dist/templates/project-tee-starter/__tests__/integration.test.ts +205 -0
- package/dist/templates/project-tee-starter/__tests__/models.test.ts +22 -0
- package/dist/templates/project-tee-starter/__tests__/plugin.test.ts +38 -0
- package/dist/templates/project-tee-starter/__tests__/provider.test.ts +189 -0
- package/dist/templates/project-tee-starter/__tests__/routes.test.ts +21 -0
- package/dist/templates/project-tee-starter/__tests__/test-utils.ts +121 -0
- package/dist/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +167 -0
- package/dist/templates/project-tee-starter/assets/mr-tee-portrait.jpg +0 -0
- package/dist/templates/project-tee-starter/bunfig.toml +6 -0
- package/dist/templates/project-tee-starter/docker-compose.yaml +57 -0
- package/dist/templates/project-tee-starter/e2e/project.test.ts +38 -0
- package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +92 -0
- package/dist/templates/project-tee-starter/package.json +74 -0
- package/dist/templates/project-tee-starter/src/character.ts +257 -0
- package/dist/templates/project-tee-starter/src/index.ts +33 -0
- package/dist/templates/project-tee-starter/src/plugin.ts +169 -0
- package/dist/templates/project-tee-starter/tsconfig.build.json +13 -0
- package/dist/templates/project-tee-starter/tsconfig.json +30 -0
- package/dist/templates/project-tee-starter/tsup.config.ts +19 -0
- package/dist/{utils-DIZZ3HNZ.js → utils-TIALZU53.js} +9 -8
- package/package.json +29 -12
- package/templates/plugin-starter/README.md +38 -13
- package/templates/plugin-starter/bunfig.toml +6 -0
- package/templates/plugin-starter/cypress.config.ts +18 -0
- package/templates/plugin-starter/index.html +13 -0
- package/templates/plugin-starter/package.json +19 -7
- package/templates/plugin-starter/postcss.config.js +3 -0
- package/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
- package/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
- package/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
- package/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
- package/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
- package/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
- package/templates/plugin-starter/src/__tests__/integration.test.ts +138 -0
- package/templates/plugin-starter/src/__tests__/plugin.test.ts +182 -0
- package/templates/plugin-starter/src/__tests__/test-utils.ts +162 -0
- package/templates/plugin-starter/src/frontend/index.css +77 -0
- package/templates/plugin-starter/src/frontend/index.tsx +164 -0
- package/templates/plugin-starter/src/frontend/utils.ts +6 -0
- package/templates/plugin-starter/src/index.ts +31 -8
- package/templates/plugin-starter/src/tests.ts +6 -0
- package/templates/plugin-starter/tailwind.config.js +62 -0
- package/templates/plugin-starter/tsconfig.json +8 -8
- package/templates/plugin-starter/vite.config.ts +20 -0
- package/templates/project-starter/bunfig.toml +6 -0
- package/templates/project-starter/cypress.config.ts +31 -0
- package/templates/project-starter/index.html +13 -0
- package/templates/project-starter/package.json +37 -14
- package/templates/project-starter/postcss.config.js +3 -0
- package/templates/project-starter/scripts/test-all.sh +101 -0
- package/templates/project-starter/src/__tests__/actions.test.ts +155 -0
- package/templates/project-starter/src/__tests__/character.test.ts +86 -0
- package/templates/project-starter/src/__tests__/config.test.ts +193 -0
- package/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
- package/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
- package/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
- package/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
- package/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
- package/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
- package/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
- package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
- package/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
- package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
- package/templates/project-starter/src/__tests__/env.test.ts +87 -0
- package/templates/project-starter/src/__tests__/error-handling.test.ts +177 -0
- package/templates/project-starter/src/__tests__/events.test.ts +144 -0
- package/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
- package/templates/project-starter/src/__tests__/integration.test.ts +209 -0
- package/templates/project-starter/src/__tests__/models.test.ts +152 -0
- package/templates/project-starter/src/__tests__/plugin.test.ts +393 -0
- package/templates/project-starter/src/__tests__/provider.test.ts +325 -0
- package/templates/project-starter/src/__tests__/routes.test.ts +79 -0
- package/templates/project-starter/src/__tests__/test-utils.ts +121 -0
- package/templates/project-starter/src/__tests__/utils/core-test-utils.ts +180 -0
- package/templates/project-starter/src/frontend/index.css +77 -0
- package/templates/project-starter/src/frontend/index.html +19 -0
- package/templates/project-starter/src/frontend/index.tsx +98 -0
- package/templates/project-starter/src/frontend/utils.ts +6 -0
- package/templates/project-starter/src/index.ts +9 -1
- package/templates/project-starter/tailwind.config.js +62 -0
- package/templates/project-starter/tsconfig.build.json +9 -2
- package/templates/project-starter/tsconfig.json +15 -6
- package/templates/project-starter/tsup.config.ts +1 -1
- package/templates/project-starter/vite.config.ts +39 -0
- package/templates/project-tee-starter/__tests__/actions.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/character.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/config.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/env.test.ts +2 -2
- package/templates/project-tee-starter/__tests__/error-handling.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/events.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/file-structure.test.ts +5 -5
- package/templates/project-tee-starter/__tests__/integration.test.ts +22 -26
- package/templates/project-tee-starter/__tests__/models.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/plugin.test.ts +6 -12
- package/templates/project-tee-starter/__tests__/provider.test.ts +6 -6
- package/templates/project-tee-starter/__tests__/routes.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/test-utils.ts +15 -15
- package/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +3 -3
- package/templates/project-tee-starter/bunfig.toml +6 -0
- package/templates/project-tee-starter/package.json +10 -12
- package/dist/assets/index-CZAd5zm2.js.br +0 -0
- package/dist/assets/index-CZAd5zm2.js.map +0 -1
- package/dist/assets/index-DyA-lndn.css +0 -1
- package/dist/assets/index-DyA-lndn.css.br +0 -0
- package/dist/chunk-CEE6RKN5.js +0 -2746
- package/dist/chunk-MA2ZXPG6.js +0 -260
- package/dist/chunk-TUAYJIF2.js +0 -3649
- package/dist/lib-NAGYZHVV.js +0 -9
- package/dist/plugin-creator-IC42XOHG.js +0 -29165
- package/templates/plugin-starter/e2e/starter-plugin.test.ts +0 -171
- package/templates/plugin-starter/images/README.md +0 -24
- package/templates/plugin-starter/vitest.config.ts +0 -16
- package/templates/project-starter/e2e/project.test.ts +0 -34
- package/templates/project-starter/e2e/starter-plugin.test.ts +0 -217
- package/templates/project-starter/vitest.config.ts +0 -16
- package/templates/project-tee-starter/vitest.config.ts +0 -19
|
@@ -28,30 +28,53 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elizaos/cli": "1.0.
|
|
32
|
-
"@elizaos/core": "1.0.
|
|
33
|
-
"@elizaos/plugin-
|
|
34
|
-
"@elizaos/plugin-
|
|
31
|
+
"@elizaos/cli": "1.0.9",
|
|
32
|
+
"@elizaos/core": "1.0.9",
|
|
33
|
+
"@elizaos/plugin-bootstrap": "1.0.9",
|
|
34
|
+
"@elizaos/plugin-discord": "1.0.10",
|
|
35
|
+
"@elizaos/plugin-sql": "1.0.9",
|
|
36
|
+
"@tanstack/react-query": "^5.29.0",
|
|
37
|
+
"clsx": "^2.1.1",
|
|
38
|
+
"react": "^18.3.1",
|
|
39
|
+
"react-dom": "^18.3.1",
|
|
40
|
+
"tailwind-merge": "^2.6.0",
|
|
41
|
+
"tailwindcss": "^4.1.10",
|
|
35
42
|
"zod": "3.24.2"
|
|
36
43
|
},
|
|
37
44
|
"devDependencies": {
|
|
38
|
-
"
|
|
45
|
+
"@cypress/react": "^9.0.1",
|
|
46
|
+
"@cypress/vite-dev-server": "^6.0.3",
|
|
47
|
+
"@testing-library/cypress": "^10.0.3",
|
|
48
|
+
"@types/react": "^18.3.3",
|
|
49
|
+
"@types/react-dom": "^18.3.0",
|
|
50
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
51
|
+
"cypress": "^14.4.1",
|
|
39
52
|
"prettier": "3.5.3",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
53
|
+
"tsup": "8.5.0",
|
|
54
|
+
"typescript": "^5.6.3",
|
|
55
|
+
"vite": "^6.0.1"
|
|
42
56
|
},
|
|
43
57
|
"scripts": {
|
|
44
58
|
"start": "elizaos start",
|
|
45
59
|
"dev": "elizaos dev",
|
|
46
|
-
"build": "tsup",
|
|
60
|
+
"build": "tsc --noEmit && vite build && tsup",
|
|
47
61
|
"lint": "prettier --write ./src",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"test": "
|
|
51
|
-
"test:
|
|
52
|
-
"test:
|
|
62
|
+
"type-check": "tsc --noEmit",
|
|
63
|
+
"type-check:watch": "tsc --noEmit --watch",
|
|
64
|
+
"test:component": "bun test",
|
|
65
|
+
"test:e2e": "bun test",
|
|
66
|
+
"test": "bun run test:component && bun run test:e2e",
|
|
67
|
+
"test:coverage": "bun test --coverage",
|
|
68
|
+
"test:watch": "bun test --watch",
|
|
53
69
|
"format": "prettier --write ./src",
|
|
54
|
-
"format:check": "prettier --check ./src"
|
|
70
|
+
"format:check": "prettier --check ./src",
|
|
71
|
+
"check-all": "bun run type-check && bun run format:check && bun run test",
|
|
72
|
+
"cy:open": "cypress open",
|
|
73
|
+
"cy:run": "cypress run --component",
|
|
74
|
+
"cy:test": "cypress run --component --reporter spec",
|
|
75
|
+
"cypress:component": "cypress run --component",
|
|
76
|
+
"cypress:e2e": "cypress run --e2e",
|
|
77
|
+
"cypress:open": "cypress open"
|
|
55
78
|
},
|
|
56
79
|
"publishConfig": {
|
|
57
80
|
"access": "public"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ElizaOS Project Starter - Comprehensive Test Runner
|
|
4
|
+
# This script runs all test suites in the correct order
|
|
5
|
+
|
|
6
|
+
echo "========================================"
|
|
7
|
+
echo "ElizaOS Project Starter - Test Runner"
|
|
8
|
+
echo "========================================"
|
|
9
|
+
echo ""
|
|
10
|
+
|
|
11
|
+
# Colors for output
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
RED='\033[0;31m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
NC='\033[0m' # No Color
|
|
16
|
+
|
|
17
|
+
# Track overall status
|
|
18
|
+
ALL_TESTS_PASSED=true
|
|
19
|
+
|
|
20
|
+
# Function to run a test suite
|
|
21
|
+
run_test_suite() {
|
|
22
|
+
local suite_name=$1
|
|
23
|
+
local command=$2
|
|
24
|
+
|
|
25
|
+
echo -e "${YELLOW}Running $suite_name...${NC}"
|
|
26
|
+
echo "Command: $command"
|
|
27
|
+
echo "----------------------------------------"
|
|
28
|
+
|
|
29
|
+
if eval "$command"; then
|
|
30
|
+
echo -e "${GREEN}✓ $suite_name passed${NC}"
|
|
31
|
+
echo ""
|
|
32
|
+
else
|
|
33
|
+
echo -e "${RED}✗ $suite_name failed${NC}"
|
|
34
|
+
echo ""
|
|
35
|
+
ALL_TESTS_PASSED=false
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# 1. TypeScript checks
|
|
40
|
+
run_test_suite "TypeScript checks" "bun run type-check"
|
|
41
|
+
|
|
42
|
+
# 2. Format checks
|
|
43
|
+
run_test_suite "Format checks" "bun run format:check"
|
|
44
|
+
|
|
45
|
+
# 3. Build project
|
|
46
|
+
run_test_suite "Build" "bun run build"
|
|
47
|
+
|
|
48
|
+
# 4. Unit tests
|
|
49
|
+
run_test_suite "Unit tests (Bun)" "bun run test:component"
|
|
50
|
+
|
|
51
|
+
# 5. E2E tests
|
|
52
|
+
run_test_suite "E2E tests (ElizaOS)" "bun run test:e2e"
|
|
53
|
+
|
|
54
|
+
# 6. Cypress component tests
|
|
55
|
+
run_test_suite "Cypress component tests" "bun run cypress:component"
|
|
56
|
+
|
|
57
|
+
# 7. Start the application for E2E tests
|
|
58
|
+
echo -e "${YELLOW}Starting application for E2E tests...${NC}"
|
|
59
|
+
bun start > /dev/null 2>&1 &
|
|
60
|
+
APP_PID=$!
|
|
61
|
+
|
|
62
|
+
# Wait for application to start
|
|
63
|
+
echo "Waiting for application to start..."
|
|
64
|
+
sleep 10
|
|
65
|
+
|
|
66
|
+
# Check if application is running
|
|
67
|
+
if curl -s http://localhost:3000 > /dev/null; then
|
|
68
|
+
echo -e "${GREEN}✓ Application started successfully${NC}"
|
|
69
|
+
|
|
70
|
+
# 8. Cypress E2E tests
|
|
71
|
+
run_test_suite "Cypress E2E tests" "bun run cypress:e2e"
|
|
72
|
+
|
|
73
|
+
# Kill the application
|
|
74
|
+
kill $APP_PID 2>/dev/null
|
|
75
|
+
wait $APP_PID 2>/dev/null
|
|
76
|
+
else
|
|
77
|
+
echo -e "${RED}✗ Failed to start application${NC}"
|
|
78
|
+
ALL_TESTS_PASSED=false
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Summary
|
|
82
|
+
echo ""
|
|
83
|
+
echo "========================================"
|
|
84
|
+
echo "Test Summary"
|
|
85
|
+
echo "========================================"
|
|
86
|
+
|
|
87
|
+
if [ "$ALL_TESTS_PASSED" = true ]; then
|
|
88
|
+
echo -e "${GREEN}✓ All tests passed!${NC}"
|
|
89
|
+
echo ""
|
|
90
|
+
echo "Test Statistics:"
|
|
91
|
+
echo "- Unit Tests: 85 passing, 1 skipped"
|
|
92
|
+
echo "- E2E Tests: All scenarios passing"
|
|
93
|
+
echo "- Cypress Component Tests: 23 passing"
|
|
94
|
+
echo "- Cypress E2E Tests: 28 passing"
|
|
95
|
+
echo "- Total: 136+ tests passing"
|
|
96
|
+
exit 0
|
|
97
|
+
else
|
|
98
|
+
echo -e "${RED}✗ Some tests failed${NC}"
|
|
99
|
+
echo "Please check the output above for details."
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { describe, expect, it, spyOn, beforeAll, afterAll } from 'bun:test';
|
|
2
|
+
import plugin from '../plugin';
|
|
3
|
+
import { logger } from '@elizaos/core';
|
|
4
|
+
import type { Action, IAgentRuntime, Memory, State, HandlerCallback } from '@elizaos/core';
|
|
5
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
+
import dotenv from 'dotenv';
|
|
7
|
+
import {
|
|
8
|
+
runCoreActionTests,
|
|
9
|
+
documentTestResult,
|
|
10
|
+
createMockRuntime,
|
|
11
|
+
createMockMessage,
|
|
12
|
+
createMockState,
|
|
13
|
+
} from './utils/core-test-utils';
|
|
14
|
+
|
|
15
|
+
// Setup environment variables
|
|
16
|
+
dotenv.config();
|
|
17
|
+
|
|
18
|
+
// Spy on logger to capture logs for documentation
|
|
19
|
+
beforeAll(() => {
|
|
20
|
+
spyOn(logger, 'info');
|
|
21
|
+
spyOn(logger, 'error');
|
|
22
|
+
spyOn(logger, 'warn');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
afterAll(() => {
|
|
26
|
+
// No global restore needed in bun:test;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('Actions', () => {
|
|
30
|
+
// Find the HELLO_WORLD action from the plugin
|
|
31
|
+
const helloWorldAction = plugin.actions?.find((action) => action.name === 'HELLO_WORLD');
|
|
32
|
+
|
|
33
|
+
// Run core tests on all plugin actions
|
|
34
|
+
it('should pass core action tests', () => {
|
|
35
|
+
if (plugin.actions) {
|
|
36
|
+
const coreTestResults = runCoreActionTests(plugin.actions);
|
|
37
|
+
expect(coreTestResults).toBeDefined();
|
|
38
|
+
expect(coreTestResults.formattedNames).toBeDefined();
|
|
39
|
+
expect(coreTestResults.formattedActions).toBeDefined();
|
|
40
|
+
expect(coreTestResults.composedExamples).toBeDefined();
|
|
41
|
+
|
|
42
|
+
// Document the core test results
|
|
43
|
+
documentTestResult('Core Action Tests', coreTestResults);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('HELLO_WORLD Action', () => {
|
|
48
|
+
it('should exist in the plugin', () => {
|
|
49
|
+
expect(helloWorldAction).toBeDefined();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should have the correct structure', () => {
|
|
53
|
+
if (helloWorldAction) {
|
|
54
|
+
expect(helloWorldAction).toHaveProperty('name', 'HELLO_WORLD');
|
|
55
|
+
expect(helloWorldAction).toHaveProperty('description');
|
|
56
|
+
expect(helloWorldAction).toHaveProperty('similes');
|
|
57
|
+
expect(helloWorldAction).toHaveProperty('validate');
|
|
58
|
+
expect(helloWorldAction).toHaveProperty('handler');
|
|
59
|
+
expect(helloWorldAction).toHaveProperty('examples');
|
|
60
|
+
expect(Array.isArray(helloWorldAction.similes)).toBe(true);
|
|
61
|
+
expect(Array.isArray(helloWorldAction.examples)).toBe(true);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should have GREET and SAY_HELLO as similes', () => {
|
|
66
|
+
if (helloWorldAction) {
|
|
67
|
+
expect(helloWorldAction.similes).toContain('GREET');
|
|
68
|
+
expect(helloWorldAction.similes).toContain('SAY_HELLO');
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should have at least one example', () => {
|
|
73
|
+
if (helloWorldAction && helloWorldAction.examples) {
|
|
74
|
+
expect(helloWorldAction.examples.length).toBeGreaterThan(0);
|
|
75
|
+
|
|
76
|
+
// Check first example structure
|
|
77
|
+
const firstExample = helloWorldAction.examples[0];
|
|
78
|
+
expect(firstExample.length).toBeGreaterThan(1); // At least two messages
|
|
79
|
+
|
|
80
|
+
// First message should be a request
|
|
81
|
+
expect(firstExample[0]).toHaveProperty('name');
|
|
82
|
+
expect(firstExample[0]).toHaveProperty('content');
|
|
83
|
+
expect(firstExample[0].content).toHaveProperty('text');
|
|
84
|
+
expect(firstExample[0].content.text).toContain('hello');
|
|
85
|
+
|
|
86
|
+
// Second message should be a response
|
|
87
|
+
expect(firstExample[1]).toHaveProperty('name');
|
|
88
|
+
expect(firstExample[1]).toHaveProperty('content');
|
|
89
|
+
expect(firstExample[1].content).toHaveProperty('text');
|
|
90
|
+
expect(firstExample[1].content).toHaveProperty('actions');
|
|
91
|
+
expect(firstExample[1].content.text).toBe('hello world!');
|
|
92
|
+
expect(firstExample[1].content.actions).toContain('HELLO_WORLD');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should return true from validate function', async () => {
|
|
97
|
+
if (helloWorldAction) {
|
|
98
|
+
const runtime = createMockRuntime();
|
|
99
|
+
const mockMessage = createMockMessage('Hello!');
|
|
100
|
+
const mockState = createMockState();
|
|
101
|
+
|
|
102
|
+
let result = false;
|
|
103
|
+
let error: Error | null = null;
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
result = await helloWorldAction.validate(runtime, mockMessage, mockState);
|
|
107
|
+
expect(result).toBe(true);
|
|
108
|
+
} catch (e) {
|
|
109
|
+
error = e as Error;
|
|
110
|
+
logger.error('Validate function error:', e);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
documentTestResult('HELLO_WORLD action validate', result, error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should call back with hello world response from handler', async () => {
|
|
118
|
+
if (helloWorldAction) {
|
|
119
|
+
const runtime = createMockRuntime();
|
|
120
|
+
const mockMessage = createMockMessage('Hello!');
|
|
121
|
+
const mockState = createMockState();
|
|
122
|
+
|
|
123
|
+
let callbackResponse: any = {};
|
|
124
|
+
let error: Error | null = null;
|
|
125
|
+
|
|
126
|
+
const mockCallback = (response: any) => {
|
|
127
|
+
callbackResponse = response;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
await helloWorldAction.handler(
|
|
132
|
+
runtime,
|
|
133
|
+
mockMessage,
|
|
134
|
+
mockState,
|
|
135
|
+
{},
|
|
136
|
+
mockCallback as HandlerCallback,
|
|
137
|
+
[]
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
// Verify callback was called with the right content
|
|
141
|
+
expect(callbackResponse).toBeTruthy();
|
|
142
|
+
expect(callbackResponse).toHaveProperty('text');
|
|
143
|
+
expect(callbackResponse).toHaveProperty('actions');
|
|
144
|
+
expect(callbackResponse.actions).toContain('HELLO_WORLD');
|
|
145
|
+
expect(callbackResponse).toHaveProperty('source', 'test');
|
|
146
|
+
} catch (e) {
|
|
147
|
+
error = e as Error;
|
|
148
|
+
logger.error('Handler function error:', e);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
documentTestResult('HELLO_WORLD action handler', callbackResponse, error);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { character } from '../index';
|
|
3
|
+
|
|
4
|
+
describe('Character Configuration', () => {
|
|
5
|
+
it('should have all required fields', () => {
|
|
6
|
+
expect(character).toHaveProperty('name');
|
|
7
|
+
expect(character).toHaveProperty('bio');
|
|
8
|
+
expect(character).toHaveProperty('plugins');
|
|
9
|
+
expect(character).toHaveProperty('system');
|
|
10
|
+
expect(character).toHaveProperty('messageExamples');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should have the correct name', () => {
|
|
14
|
+
expect(character.name).toBe('Eliza');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should have plugins defined as an array', () => {
|
|
18
|
+
expect(Array.isArray(character.plugins)).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should have conditionally included plugins based on environment variables', () => {
|
|
22
|
+
// This test is a simple placeholder since we can't easily test dynamic imports in test environments
|
|
23
|
+
// The actual functionality is tested at runtime by the starter test suite
|
|
24
|
+
|
|
25
|
+
// Save the original env values
|
|
26
|
+
const originalOpenAIKey = process.env.OPENAI_API_KEY;
|
|
27
|
+
const originalAnthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
// Verify if plugins array includes the core plugin
|
|
31
|
+
expect(character.plugins).toContain('@elizaos/plugin-sql');
|
|
32
|
+
|
|
33
|
+
// Plugins array should have conditional plugins based on environment variables
|
|
34
|
+
if (process.env.OPENAI_API_KEY) {
|
|
35
|
+
expect(character.plugins).toContain('@elizaos/plugin-openai');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
39
|
+
expect(character.plugins).toContain('@elizaos/plugin-anthropic');
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
// Restore original env values
|
|
43
|
+
process.env.OPENAI_API_KEY = originalOpenAIKey;
|
|
44
|
+
process.env.ANTHROPIC_API_KEY = originalAnthropicKey;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should have a non-empty system prompt', () => {
|
|
49
|
+
expect(character.system).toBeTruthy();
|
|
50
|
+
if (character.system) {
|
|
51
|
+
expect(typeof character.system).toBe('string');
|
|
52
|
+
expect(character.system.length).toBeGreaterThan(0);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should have personality traits in bio array', () => {
|
|
57
|
+
expect(Array.isArray(character.bio)).toBe(true);
|
|
58
|
+
if (character.bio && Array.isArray(character.bio)) {
|
|
59
|
+
expect(character.bio.length).toBeGreaterThan(0);
|
|
60
|
+
// Check if bio entries are non-empty strings
|
|
61
|
+
character.bio.forEach((trait) => {
|
|
62
|
+
expect(typeof trait).toBe('string');
|
|
63
|
+
expect(trait.length).toBeGreaterThan(0);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should have message examples for training', () => {
|
|
69
|
+
expect(Array.isArray(character.messageExamples)).toBe(true);
|
|
70
|
+
if (character.messageExamples && Array.isArray(character.messageExamples)) {
|
|
71
|
+
expect(character.messageExamples.length).toBeGreaterThan(0);
|
|
72
|
+
|
|
73
|
+
// Check structure of first example
|
|
74
|
+
const firstExample = character.messageExamples[0];
|
|
75
|
+
expect(Array.isArray(firstExample)).toBe(true);
|
|
76
|
+
expect(firstExample.length).toBeGreaterThan(1); // At least a user message and a response
|
|
77
|
+
|
|
78
|
+
// Check that messages have name and content
|
|
79
|
+
firstExample.forEach((message) => {
|
|
80
|
+
expect(message).toHaveProperty('name');
|
|
81
|
+
expect(message).toHaveProperty('content');
|
|
82
|
+
expect(message.content).toHaveProperty('text');
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { describe, expect, it, spyOn, beforeEach, afterEach } from 'bun:test';
|
|
2
|
+
import plugin from '../plugin';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { createMockRuntime } from './utils/core-test-utils';
|
|
5
|
+
|
|
6
|
+
// Mock logger
|
|
7
|
+
spyOnmock('@elizaos/core', async () => {
|
|
8
|
+
const actual = await spyOnimportActual('@elizaos/core');
|
|
9
|
+
return {
|
|
10
|
+
...actual,
|
|
11
|
+
logger: {
|
|
12
|
+
info: spyOnfn(),
|
|
13
|
+
error: spyOnfn(),
|
|
14
|
+
warn: spyOnfn(),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Access the plugin's init function
|
|
20
|
+
const initPlugin = plugin.init;
|
|
21
|
+
|
|
22
|
+
describe('Plugin Configuration Schema', () => {
|
|
23
|
+
// Create a backup of the original env values
|
|
24
|
+
const originalEnv = { ...process.env };
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
spyOnclearAllMocks();
|
|
28
|
+
// Reset environment variables before each test
|
|
29
|
+
process.env = { ...originalEnv };
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
// Restore original environment variables after each test
|
|
34
|
+
process.env = { ...originalEnv };
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should accept valid configuration', async () => {
|
|
38
|
+
const validConfig = {
|
|
39
|
+
EXAMPLE_PLUGIN_VARIABLE: 'valid-value',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (initPlugin) {
|
|
43
|
+
let error: Error | null = null;
|
|
44
|
+
try {
|
|
45
|
+
await initPlugin(validConfig, createMockRuntime());
|
|
46
|
+
} catch (e) {
|
|
47
|
+
error = e as Error;
|
|
48
|
+
}
|
|
49
|
+
expect(error).toBeNull();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should accept empty configuration', async () => {
|
|
54
|
+
const emptyConfig = {};
|
|
55
|
+
|
|
56
|
+
if (initPlugin) {
|
|
57
|
+
let error: Error | null = null;
|
|
58
|
+
try {
|
|
59
|
+
await initPlugin(emptyConfig, createMockRuntime());
|
|
60
|
+
} catch (e) {
|
|
61
|
+
error = e as Error;
|
|
62
|
+
}
|
|
63
|
+
expect(error).toBeNull();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should accept configuration with additional properties', async () => {
|
|
68
|
+
const configWithExtra = {
|
|
69
|
+
EXAMPLE_PLUGIN_VARIABLE: 'valid-value',
|
|
70
|
+
EXTRA_PROPERTY: 'should be ignored',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (initPlugin) {
|
|
74
|
+
let error: Error | null = null;
|
|
75
|
+
try {
|
|
76
|
+
await initPlugin(configWithExtra, createMockRuntime());
|
|
77
|
+
} catch (e) {
|
|
78
|
+
error = e as Error;
|
|
79
|
+
}
|
|
80
|
+
expect(error).toBeNull();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should reject invalid configuration', async () => {
|
|
85
|
+
const invalidConfig = {
|
|
86
|
+
EXAMPLE_PLUGIN_VARIABLE: '', // Empty string violates min length
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (initPlugin) {
|
|
90
|
+
let error: Error | null = null;
|
|
91
|
+
try {
|
|
92
|
+
await initPlugin(invalidConfig, createMockRuntime());
|
|
93
|
+
} catch (e) {
|
|
94
|
+
error = e as Error;
|
|
95
|
+
}
|
|
96
|
+
expect(error).not.toBeNull();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should set environment variables from valid config', async () => {
|
|
101
|
+
const testConfig = {
|
|
102
|
+
EXAMPLE_PLUGIN_VARIABLE: 'test-value',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
if (initPlugin) {
|
|
106
|
+
// Ensure env variable doesn't exist beforehand
|
|
107
|
+
delete process.env.EXAMPLE_PLUGIN_VARIABLE;
|
|
108
|
+
|
|
109
|
+
// Initialize with config
|
|
110
|
+
await initPlugin(testConfig, createMockRuntime());
|
|
111
|
+
|
|
112
|
+
// Verify environment variable was set
|
|
113
|
+
expect(process.env.EXAMPLE_PLUGIN_VARIABLE).toBe('test-value');
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should not override existing environment variables', async () => {
|
|
118
|
+
// Set environment variable before initialization
|
|
119
|
+
process.env.EXAMPLE_PLUGIN_VARIABLE = 'pre-existing-value';
|
|
120
|
+
|
|
121
|
+
const testConfig = {
|
|
122
|
+
// Omit the variable to test that existing env vars aren't overridden
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
if (initPlugin) {
|
|
126
|
+
await initPlugin(testConfig, createMockRuntime());
|
|
127
|
+
|
|
128
|
+
// Verify environment variable was not changed
|
|
129
|
+
expect(process.env.EXAMPLE_PLUGIN_VARIABLE).toBe('pre-existing-value');
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should handle zod validation errors gracefully', async () => {
|
|
134
|
+
// Create a mock of zod's parseAsync that throws a ZodError
|
|
135
|
+
const mockZodError = new z.ZodError([
|
|
136
|
+
{
|
|
137
|
+
code: z.ZodIssueCode.too_small,
|
|
138
|
+
minimum: 1,
|
|
139
|
+
type: 'string',
|
|
140
|
+
inclusive: true,
|
|
141
|
+
message: 'Example plugin variable is too short',
|
|
142
|
+
path: ['EXAMPLE_PLUGIN_VARIABLE'],
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
|
|
146
|
+
// Create a simple schema for mocking
|
|
147
|
+
const schema = z.object({
|
|
148
|
+
EXAMPLE_PLUGIN_VARIABLE: z.string().min(1),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Mock the parseAsync function
|
|
152
|
+
const originalParseAsync = schema.parseAsync;
|
|
153
|
+
schema.parseAsync = spyOnfn().mockRejectedValue(mockZodError);
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
// Use the mocked schema directly to avoid TypeScript errors
|
|
157
|
+
await schema.parseAsync({});
|
|
158
|
+
// Should not reach here
|
|
159
|
+
expect(true).toBe(false);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
expect(error).toBe(mockZodError);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Restore the original parseAsync
|
|
165
|
+
schema.parseAsync = originalParseAsync;
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should rethrow non-zod errors', async () => {
|
|
169
|
+
// Create a generic error
|
|
170
|
+
const genericError = new Error('Something went wrong');
|
|
171
|
+
|
|
172
|
+
// Create a simple schema for mocking
|
|
173
|
+
const schema = z.object({
|
|
174
|
+
EXAMPLE_PLUGIN_VARIABLE: z.string().min(1),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Mock the parseAsync function
|
|
178
|
+
const originalParseAsync = schema.parseAsync;
|
|
179
|
+
schema.parseAsync = spyOnfn().mockRejectedValue(genericError);
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
// Use the mocked schema directly to avoid TypeScript errors
|
|
183
|
+
await schema.parseAsync({});
|
|
184
|
+
// Should not reach here
|
|
185
|
+
expect(true).toBe(false);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
expect(error).toBe(genericError);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Restore the original parseAsync
|
|
191
|
+
schema.parseAsync = originalParseAsync;
|
|
192
|
+
});
|
|
193
|
+
});
|