**test(api): add integration tests for API endpoints and core functionality**

- **Integration Tests**:
  - Introduced `api-integration.test.ts` to validate API functionality:
    - Verifies text insertion, vector embedding generation, and search operations.
    - Confirms HNSW index correctness for vector similarity search.
    - Ensures no dimensional mismatches in embeddings.

- **Test Server**:
  - Added test server utilizing Express for endpoint simulation (`/insert` and `/search/text`).

- **Dependencies**:
  - Introduced `express` and `node-fetch` as new dependencies for testing purposes.

- **Vitest Fix**:
  - Updated `vitest.config.ts` to resolve the `process.memoryUsage` error by setting `logHeapUsage: false`.

- **Package Updates**:
  - Modified `package-lock.json` to include newly added dependencies and updates.

**Purpose**: Guarantees the stability of core API endpoints and vector-related functionality, ensuring reliable behavior for end-to-end scenarios.
This commit is contained in:
David Snelling 2025-07-28 10:04:45 -07:00
parent 5d607068a8
commit 7f082df6a3
11 changed files with 1418 additions and 85 deletions

View file

@ -74,7 +74,8 @@
"test:core": "vitest run tests/core.test.ts",
"test:coverage": "vitest run --coverage",
"test:size": "vitest run tests/package-size-limit.test.ts",
"test:all": "npm run build && vitest run"
"test:all": "npm run build && vitest run",
"test:report": "vitest run --reporter verbose"
},
"keywords": [
"vector-database",
@ -122,22 +123,25 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-typescript": "^11.1.6",
"@types/express": "^5.0.3",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.11.30",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"eslint": "^8.57.0",
"express": "^5.1.0",
"happy-dom": "^18.0.1",
"jsdom": "^26.1.0",
"node-fetch": "^3.3.2",
"puppeteer": "^22.5.0",
"rollup": "^4.13.0",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.6.2",
"typescript": "^5.4.5",
"vitest": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4"
"vitest": "^3.2.4"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.540.0",