/** * 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); }); }); });