Initial release of Web Tools 0.0.5
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user