Commit graph

2 commits

Author SHA1 Message Date
5958502cf3 **test(tests): enhance test clarity, isolation, and robustness**
- **Test Improvements**:
  - Introduced data-clearing steps (`.clear()`) across critical test cases for ensuring better test isolation and preventing state leakage.
  - Extended support for overriding global utilities (`testUtils`) and added fallback behaviors for test vector creation.

- **Configuration Updates**:
  - Added support for `distanceFunction` as an alternative to `metric` in vector operations for consistency.
  - Adjusted and unified asynchronous `timeout` handling across test suites for predictability.

- **Purpose**:
  - These updates improve reliability, maintainability, and clarity in test cases while ensuring compatibility across diverse test environments.
2025-07-16 11:39:53 -07:00
8ffc7115a5 **test(tests): add comprehensive test suite for Brainy functionality**
- **New Tests Added**:
  - Introduced multiple test suites covering core functionalities (`core.test.ts`), vector operations (`vector-operations.test.ts`), Node.js environment (`environment.node.test.ts`), browser setup (`environment.browser.test.ts`), and TensorFlow.js-specific behaviors (`tensorflow-patch.test.ts`).
  - Added performance, scalability, and error-handling tests to ensure robust validation of vector addition, search, and text embedding functionalities.
  - Introduced setup utilities (`tests/setup.ts`) and standardized test utilities for creating predictable test cases.

- **Configuration**:
  - Created `vitest.config.ts` for custom test configurations, including support for modern test environments (`jsdom`, `happy-dom`) and extended timeouts for asynchronous operations.

- **Validation**:
  - Includes compatibility checks for TensorFlow.js imports and ensures proper handling of `TextEncoder`/`TextDecoder` in Node.js environments.

This commit significantly enhances the testing coverage and structure, ensuring Brainy functionality is robust, cross-platform, and aligned with evolving reliability standards.
2025-07-15 11:56:16 -07:00