feat: schema builder's create flow

This commit is contained in:
Florian Sylvain committed 2026-10-20 00:29:01 +02:00
1 parent f514146fed
commit 083cc9e23e
71 files changed
+7223 -61

No files matched your search

@@ -189,6 +189,44 @@ describe('Nuxt UI shell foundation and router guards', () => {
)
})
it('The new content type route is registered before the type key route, verified-only, titled Schema', () => {
const resolved = router.resolve('/schema/new')
expect(resolved.matched).toHaveLength(1)
expect(resolved.matched[0]!.path).toBe('/schema/new')
expect(resolved.params.key).toBeUndefined()
expect(resolved.meta.auth).toBe('verified')
expect(resolved.meta.title).toBe('Schema')
expect(resolved.meta.needsBuiltinTypes).not.toBe(true)
expect(router.resolve('/schema/articles').meta.needsBuiltinTypes).toBe(true)
expect(router.resolve('/schema').meta.needsBuiltinTypes).toBe(true)
})
it('The new content type route redirects an unverified session to the pending page', async () => {
const getMe = vi.fn().mockResolvedValue({ verified: false })
vi.mocked(useApi).mockReturnValue({ getMe })
setUpSession()
await router.push('/schema/new')
mountApp()
await vi.waitFor(() => expect(router.currentRoute.value.path).toBe('/register/pending'))
})
it('The new content type route redirects a signed-out visitor to login with the original path', async () => {
const getMe = vi.fn().mockRejectedValue(new ApiError(401))
vi.mocked(useApi).mockReturnValue({ getMe })
setUpSession()
await router.push('/schema/new')
mountApp()
await flushPromises()
expect(router.currentRoute.value.fullPath).toBe(
'/login?redirect=/schema/new&reason=expired',
)
})
it('A session-only route admits an unverified session', async () => {
const getMe = vi.fn().mockResolvedValue({ verified: false })
vi.mocked(useApi).mockReturnValue({ getMe })
+6 -1
View File
@@ -90,12 +90,17 @@ const routes: RouteRecordRaw[] = [
{
path: '/schema',
component: () => import('@/views/SchemaView.vue'),
meta: { auth: 'verified', title: 'Schema', needsBuiltinTypes: true },
},
{
path: '/schema/new',
component: () => import('@/views/SchemaBuilderView.vue'),
meta: { auth: 'verified', title: 'Schema' },
},
{
path: '/schema/:key',
component: () => import('@/views/SchemaTypeView.vue'),
meta: { auth: 'verified', title: 'Schema' },
meta: { auth: 'verified', title: 'Schema', needsBuiltinTypes: true },
},
{
path: '/activity',