This commit is contained in:
thePR0M3TH3AN
2026-02-20 10:26:39 -05:00
parent cc1ba691cb
commit deadeaafac
73 changed files with 3085 additions and 699 deletions

View File

@@ -0,0 +1,30 @@
import { describe, it } from 'node:test';
import assert from 'node:assert';
import { estimateTokenCount } from '../src/services/memory/formatter.js';
describe('formatter', () => {
describe('estimateTokenCount', () => {
it('should return 0 for empty string', () => {
const result = estimateTokenCount('');
assert.strictEqual(result, 0);
});
it('should return 0 for null', () => {
const result = estimateTokenCount(null);
assert.strictEqual(result, 0);
});
it('should estimate tokens at approximately 4 chars per token', () => {
const text = 'This is a test string with some content';
const result = estimateTokenCount(text);
// 40 chars / 4 = 10 tokens (approximately)
assert(result > 0);
});
it('should handle long strings', () => {
const text = 'a'.repeat(1000);
const result = estimateTokenCount(text);
assert.strictEqual(result, 250);
});
});
});