feat(core): add command, intent, and routing primitives
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SessionIndexer, tokenize } from './indexer.js';
|
||||
|
||||
describe('session indexer', () => {
|
||||
it('tokenizes text with stopword filtering', () => {
|
||||
const tokens = tokenize('Deploy the backend service to production and verify logs');
|
||||
expect(tokens).toContain('deploy');
|
||||
expect(tokens).toContain('backend');
|
||||
expect(tokens).toContain('service');
|
||||
expect(tokens).not.toContain('the');
|
||||
});
|
||||
|
||||
it('extracts top keywords and topics', () => {
|
||||
const indexer = new SessionIndexer({ maxKeywords: 5 });
|
||||
const metadata = indexer.indexText('deploy deploy backend service backend api release');
|
||||
|
||||
expect(metadata.keywords.length).toBeLessThanOrEqual(5);
|
||||
expect(metadata.keywords).toContain('deploy');
|
||||
expect(metadata.topics.length).toBeLessThanOrEqual(3);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user