Initial release of Web Tools 0.0.5

This commit is contained in:
mid
2026-08-07 21:51:15 +08:00
commit fa14e9e5b9
71 changed files with 6365 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
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)
})
})