fix architecture and write new tests

This commit is contained in:
root
2026-06-10 00:40:19 -04:00
parent 560da1cadf
commit 80a597bc10
377 changed files with 84020 additions and 1337 deletions
@@ -0,0 +1,31 @@
import React, { isValidElement } from 'react'
import { describe, expect, it, vi } from 'vitest'
vi.mock('@/components/PublicHeader', () => ({ default: function MockAdminHeader() { return React.createElement('admin-header') } }))
vi.mock('@/components/PublicFooter', () => ({ default: function MockAdminFooter() { return React.createElement('admin-footer') } }))
import PublicShell from './PublicShell'
function childTypes(node: React.ReactElement): string[] {
return React.Children.toArray(node.props.children).filter(isValidElement).map((child) => {
const type = child.type as any
if (typeof type === 'string') return type
return type.displayName ?? type.name ?? 'anonymous'
})
}
describe('admin PublicShell', () => {
it('always renders the admin public chrome around children', () => {
const shell = PublicShell({ children: React.createElement('section', { id: 'login' }) })
expect(childTypes(shell)).toEqual(['MockAdminHeader', 'div', 'MockAdminFooter'])
})
it('uses a flex column root so footer placement stays stable', () => {
const shell = PublicShell({ children: React.createElement('section') })
expect(shell.props.className).toContain('flex')
expect(shell.props.className).toContain('min-h-screen')
expect(shell.props.className).toContain('flex-col')
})
})