taxonomy.test.js
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Unit Tests — taxonomy.js
*/
import { describe, it, expect, beforeAll } from 'vitest';
describe('taxonomy', () => {
let taxonomy;
beforeAll(() => {
taxonomy = require('../../config/taxonomy');
});
describe('ROLES, SCENES, PLATFORMS', () => {
it('should export ROLES array', () => {
expect(Array.isArray(taxonomy.ROLES)).toBe(true);
expect(taxonomy.ROLES.length).toBeGreaterThan(0);
expect(taxonomy.ROLES[0]).toHaveProperty('id');
expect(taxonomy.ROLES[0]).toHaveProperty('name');
});
it('should export SCENES array', () => {
expect(Array.isArray(taxonomy.SCENES)).toBe(true);
expect(taxonomy.SCENES.length).toBeGreaterThan(0);
});
it('should export PLATFORMS array', () => {
expect(Array.isArray(taxonomy.PLATFORMS)).toBe(true);
expect(taxonomy.PLATFORMS.length).toBeGreaterThan(0);
});
});
describe('autoTag', () => {
it('should auto-tag a skill with required structure', () => {
const tags = taxonomy.autoTag({
skillName: 'web_scraper',
description: 'Scrape webpages for data extraction',
});
expect(tags).toHaveProperty('roles');
expect(tags).toHaveProperty('scenes');
expect(tags).toHaveProperty('platforms');
expect(Array.isArray(tags.roles)).toBe(true);
});
it('should handle empty input gracefully', () => {
const tags = taxonomy.autoTag({ skillName: '', description: '' });
expect(tags).toHaveProperty('roles');
expect(Array.isArray(tags.roles)).toBe(true);
});
});
});