brainy/test-fix.js
David Snelling 7f082df6a3 **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.
2025-07-28 10:04:45 -07:00

20 lines
666 B
JavaScript

// Simple test script to verify the FileSystemStorage fix
const { createStorage } = require('./dist/unified.js');
async function testFileSystemStorage() {
try {
console.log('Creating storage with forceFileSystemStorage: true');
const storage = await createStorage({ forceFileSystemStorage: true });
console.log('Storage created successfully');
console.log('Initializing storage');
await storage.init();
console.log('Storage initialized successfully');
console.log('Test passed: No TypeError about undefined path.join');
} catch (error) {
console.error('Test failed with error:', error);
}
}
testFileSystemStorage();