moving
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled

This commit is contained in:
Oleg Maslov
2026-09-02 10:10:29 +02:00
commit 0c3e2ead3b
3841 changed files with 970576 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { describe, it, expect } from 'vitest';
import { normalizeEntityName, findDuplicates } from '../src/mind/entity-normalizer.js';
describe('Entity Normalizer', () => {
it('normalizes common abbreviations', () => {
expect(normalizeEntityName('NYC')).toBe('new york city');
expect(normalizeEntityName('JS')).toBe('javascript');
expect(normalizeEntityName('TS')).toBe('typescript');
expect(normalizeEntityName('PG')).toBe('postgresql');
expect(normalizeEntityName('k8s')).toBe('kubernetes');
});
it('finds duplicate entity groups', () => {
const entities = [
{ id: '1', name: 'PostgreSQL', type: 'technology' },
{ id: '2', name: 'Postgres', type: 'technology' },
{ id: '3', name: 'React', type: 'technology' },
];
const groups = findDuplicates(entities);
const pgGroup = groups.find(g => g.some(e => e.id === '1'));
expect(pgGroup).toBeDefined();
expect(pgGroup!.length).toBeGreaterThanOrEqual(2);
});
it('does not group unrelated entities', () => {
const entities = [
{ id: '1', name: 'React', type: 'technology' },
{ id: '2', name: 'Docker', type: 'technology' },
];
const groups = findDuplicates(entities);
expect(groups.every(g => g.length === 1)).toBe(true);
});
});