mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
Checkpoint: File edits
Automatic checkpoint created by Claude Code - Branch: v3 - Timestamp: 2026-01-07T04:52:22Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bee16cc3ca
commit
49487a49f0
1 file changed
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Minimal tests - no heavy deps
|
||||
*/
|
||||
|
||||
import { test, describe } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
// Only import lightweight utilities
|
||||
import {
|
||||
chunkText,
|
||||
estimateTokens,
|
||||
} from '../dist/chunking.js';
|
||||
|
||||
import {
|
||||
l2Normalize,
|
||||
l2Norm,
|
||||
isNormalized,
|
||||
} from '../dist/normalization.js';
|
||||
|
||||
import {
|
||||
euclideanToPoincare,
|
||||
isInPoincareBall,
|
||||
} from '../dist/hyperbolic.js';
|
||||
|
||||
describe('Chunking', () => {
|
||||
test('chunks text', () => {
|
||||
const result = chunkText('Hello world. This is a test.', { maxChunkSize: 15, strategy: 'character' });
|
||||
assert.ok(result.totalChunks > 0);
|
||||
});
|
||||
|
||||
test('estimates tokens', () => {
|
||||
assert.equal(estimateTokens('Hello world'), 3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Normalization', () => {
|
||||
test('L2 normalize', () => {
|
||||
const vec = new Float32Array([3, 4, 0]);
|
||||
const normalized = l2Normalize(vec);
|
||||
assert.ok(Math.abs(l2Norm(normalized) - 1) < 1e-5);
|
||||
});
|
||||
|
||||
test('isNormalized', () => {
|
||||
const vec = new Float32Array([3, 4, 0]);
|
||||
assert.ok(!isNormalized(vec));
|
||||
assert.ok(isNormalized(l2Normalize(vec)));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Hyperbolic', () => {
|
||||
test('euclideanToPoincare stays in ball', () => {
|
||||
const vec = new Float32Array([0.5, 0.3, 0.2]);
|
||||
const poincare = euclideanToPoincare(vec);
|
||||
assert.ok(isInPoincareBall(poincare));
|
||||
});
|
||||
});
|
||||
|
||||
console.log('Minimal tests completed!');
|
||||
Reference in new issue
Block a user