test: add comprehensive tests for CLI and scenarios

Add unit tests for:
- CLI TpmClient (api-client.test.ts) - 26 tests covering authentication,
  tool execution, agent/collection/scenario management, error handling
- Scenario evaluation (evaluate.test.ts) - 16 tests for regex assertions
  and verdict determination
- Cosine similarity (similarity.test.ts) - 16 tests for embedding comparison

Add integration tests for scenarios:
- CRUD operations (scenarios-crud.integration.test.ts)
- Run execution and quota management (scenarios-run.integration.test.ts)

Configure vitest for CLI package with @tpmjs/test shared config.
This commit is contained in:
Ajax Davis 2026-01-25 03:28:28 +10:00
parent 9c731d582e
commit a44f38eda9
8 changed files with 1491 additions and 1 deletions

View file

@ -73,6 +73,7 @@
"scripts": {
"build": "tsup && oclif manifest",
"dev": "tsup --watch",
"test": "vitest",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist .turbo oclif.manifest.json",
"postpack": "rm -f oclif.manifest.json",
@ -91,11 +92,13 @@
"cli-table3": "^0.6.5"
},
"devDependencies": {
"@tpmjs/test": "workspace:*",
"@tpmjs/tsconfig": "workspace:*",
"@types/node": "^22.15.29",
"oclif": "^4.17.35",
"tsup": "^8.5.1",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"vitest": "^4.0.16"
},
"publishConfig": {
"access": "public"