test(10-05): bring every SPA module, composable and component under Vitest
- 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
This commit is contained in:
34
admin/tests/app/icons.test.ts
Normal file
34
admin/tests/app/icons.test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Archive, Disc3, Settings, Square, Tags } from '@lucide/vue'
|
||||
import { fallbackIcon, iconFor, icons, winterIcons } from '../../src/app/icons'
|
||||
|
||||
describe('iconFor', () => {
|
||||
it('resolves lucide names', () => {
|
||||
expect(iconFor('disc-3')).toBe(Disc3)
|
||||
expect(iconFor('tags')).toBe(Tags)
|
||||
expect(iconFor(' tags ')).toBe(Tags)
|
||||
})
|
||||
|
||||
it('resolves Winter icon aliases', () => {
|
||||
expect(iconFor('icon-archive')).toBe(Archive)
|
||||
expect(iconFor('icon-cog')).toBe(Settings)
|
||||
})
|
||||
|
||||
it('falls back to the neutral square for unknown, empty or missing names', () => {
|
||||
expect(fallbackIcon).toBe(Square)
|
||||
expect(iconFor('unknown-icon-name')).toBe(Square)
|
||||
expect(iconFor('icon-unknown')).toBe(Square)
|
||||
expect(iconFor('')).toBe(Square)
|
||||
expect(iconFor(null)).toBe(Square)
|
||||
expect(iconFor(undefined)).toBe(Square)
|
||||
expect(iconFor('constructor')).toBe(Square)
|
||||
expect(iconFor('toString')).toBe(Square)
|
||||
expect(iconFor('__proto__')).toBe(Square)
|
||||
})
|
||||
|
||||
it('maps every Winter alias onto a registered lucide icon', () => {
|
||||
for (const [alias, name] of Object.entries(winterIcons)) {
|
||||
expect(icons[name], alias).toBeDefined()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user