17 lines
861 B
TypeScript
17 lines
861 B
TypeScript
/** @jest-environment node */
|
|
import { desktopAgentRules } from '../desktop-client/agent-rules'
|
|
describe('desktop Agent versioned rule catalog', () => {
|
|
test('lists only real ready combinations and returns an exact scoped package', () => {
|
|
const index = desktopAgentRules(null) as any
|
|
expect(index.items).toHaveLength(1)
|
|
expect(index.items[0].label).toBe('顾家 · 电脑桌')
|
|
const selected = desktopAgentRules(index.items[0].id) as any
|
|
expect(selected.catalog.brands).toHaveLength(1)
|
|
expect(selected.catalog.shops[0].id).toBe(index.items[0].shopId)
|
|
expect(selected.catalog.categories[0].id).toBe(index.items[0].categoryId)
|
|
expect(selected.catalog.bindings).toHaveLength(1)
|
|
expect(() => desktopAgentRules('unknown')).toThrow('尚未配置')
|
|
expect(() => desktopAgentRules('../other')).toThrow('编号无效')
|
|
})
|
|
})
|