import { describe, expect, it } from 'vitest' import defaultNavigation from '../shared/default-navigation.json' import catalog from '../shared/tool-catalog.json' import { assertToolRegistryConsistency, categories, iconComponents, toolComponents, tools, } from '../src/tools/registry' describe('tool catalog consistency', () => { it('keeps catalog categories, icons and lazy components registered', () => { expect(() => assertToolRegistryConsistency()).not.toThrow() expect(new Set(categories.map(({ id }) => id)).size).toBe(categories.length) expect(new Set(tools.map(({ id }) => id)).size).toBe(tools.length) expect(tools.every((tool) => Boolean(iconComponents[tool.icon]))).toBe(true) expect(Object.keys(toolComponents).sort()).toEqual(tools.map(({ id }) => id).sort()) }) it('lists every catalog category and tool exactly once in default navigation', () => { const navigationCategoryIds = defaultNavigation.categories.map(({ id }) => id) const navigationToolIds = defaultNavigation.categories.flatMap(({ tools: ids }) => ids) expect(navigationCategoryIds).toEqual(catalog.categories.map(({ id }) => id)) expect(navigationToolIds.sort()).toEqual(catalog.tools.map(({ id }) => id).sort()) expect(new Set(navigationToolIds).size).toBe(navigationToolIds.length) }) })