- 41 unit and component suites under admin/tests/{app,state,shell,list,form,relation,views,ui}
covering states and a11y roles; every src module is imported by a test
- typed fixture helper assigns each JSON fixture to its generated OpenAPI type
- fix: iconFor ignores inherited object members such as "constructor"
- fix: field controls import ./control instead of the registry (import cycle
left a renderer unregistered depending on module load order)
- fix: dropdown shows the placeholder for an unknown stored value next to an emptyOption
- fix: list announces a failed schema load even when the rows arrive after it
- tailwind no longer scans admin/tests; boardwalk/dist rebuilt
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
controllerIdFromParams,
|
|
controllerIdFromPath,
|
|
controllerPath,
|
|
parseControllerId,
|
|
pluginKey,
|
|
} from '../../src/app/controllerRoutes'
|
|
|
|
describe('controller routes (D-10)', () => {
|
|
it('parses a three-segment controller id', () => {
|
|
expect(parseControllerId('acme.demo.widgets')).toEqual({ vendor: 'acme', plugin: 'demo', controller: 'widgets' })
|
|
expect(parseControllerId('a_b.c-d.E9')).toEqual({ vendor: 'a_b', plugin: 'c-d', controller: 'E9' })
|
|
})
|
|
|
|
it.each(['', 'acme.demo', 'acme.demo.widgets.extra', 'acme..widgets', 'acme.demo.wid gets', 'acme/demo/widgets', '../x.y.z'])(
|
|
'rejects %j',
|
|
(id) => {
|
|
expect(parseControllerId(id)).toBeNull()
|
|
expect(controllerPath(id)).toBeNull()
|
|
expect(pluginKey(id)).toBeNull()
|
|
},
|
|
)
|
|
|
|
it('maps ids and paths both ways', () => {
|
|
expect(controllerPath('acme.demo.widgets')).toBe('/acme/demo/widgets')
|
|
expect(controllerIdFromParams({ vendor: 'acme', plugin: 'demo', controller: 'widgets' })).toBe('acme.demo.widgets')
|
|
expect(controllerIdFromPath('/acme/demo/widgets')).toBe('acme.demo.widgets')
|
|
expect(controllerIdFromPath('/acme/demo/widgets/12')).toBe('acme.demo.widgets')
|
|
expect(controllerIdFromPath('acme/demo/widgets/')).toBe('acme.demo.widgets')
|
|
expect(controllerIdFromPath('/settings')).toBeNull()
|
|
expect(controllerIdFromPath('/a/b')).toBeNull()
|
|
expect(controllerIdFromPath('/a/b c/d')).toBeNull()
|
|
})
|
|
|
|
it('names the owning plugin of a controller', () => {
|
|
expect(pluginKey('acme.demo.widgets')).toBe('acme.demo')
|
|
})
|
|
})
|