Give the tests their own database and drop the template specs
pytest was deleting every user on teardown against the development database. The engine is built at import time, so tests/__init__.py pins POSTGRES_DB before app.core.config loads; the fixture creates the schema and drops the database again, guarded against a name that is not _test. Playwright now defaults at the integrated stack, which is the origin the API allows, so a bare `bunx playwright test` works without a dev server. The four template specs that asserted copy we no longer ship are gone, along with the helpers they were the last callers of. The admin edit assertion was page-wide and only ever passed on a fresh database. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkmeRiyeYmVZqJVwuyHq9o
This commit is contained in:
co-authored by
Claude Opus 5
parent
aa0e760615
commit
82356810ce
@@ -1,97 +0,0 @@
|
||||
import { Link as RouterLink } from "@tanstack/react-router"
|
||||
import { ChevronsUpDown, LogOut, Settings } from "lucide-react"
|
||||
|
||||
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import {
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar"
|
||||
import useAuth from "@/hooks/useAuth"
|
||||
import { getInitials } from "@/utils"
|
||||
|
||||
interface UserInfoProps {
|
||||
fullName?: string
|
||||
email?: string
|
||||
}
|
||||
|
||||
function UserInfo({ fullName, email }: UserInfoProps) {
|
||||
return (
|
||||
<div className="flex items-center gap-2.5 w-full min-w-0">
|
||||
<Avatar className="size-8">
|
||||
<AvatarFallback className="bg-zinc-600 text-white">
|
||||
{getInitials(fullName || "User")}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex flex-col items-start min-w-0">
|
||||
<p className="text-sm font-medium truncate w-full">{fullName}</p>
|
||||
<p className="text-xs text-muted-foreground truncate w-full">{email}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function User({ user }: { user: any }) {
|
||||
const { logout } = useAuth()
|
||||
const { isMobile, setOpenMobile } = useSidebar()
|
||||
|
||||
if (!user) return null
|
||||
|
||||
const handleMenuClick = () => {
|
||||
if (isMobile) {
|
||||
setOpenMobile(false)
|
||||
}
|
||||
}
|
||||
const handleLogout = async () => {
|
||||
logout()
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<SidebarMenuButton
|
||||
size="lg"
|
||||
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
||||
data-testid="user-menu"
|
||||
>
|
||||
<UserInfo fullName={user?.full_name} email={user?.email} />
|
||||
<ChevronsUpDown className="ml-auto size-4 text-muted-foreground" />
|
||||
</SidebarMenuButton>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
||||
side={isMobile ? "bottom" : "right"}
|
||||
align="end"
|
||||
sideOffset={4}
|
||||
>
|
||||
<DropdownMenuLabel className="p-0 font-normal">
|
||||
<UserInfo fullName={user?.full_name} email={user?.email} />
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<RouterLink to="/settings" onClick={handleMenuClick}>
|
||||
<DropdownMenuItem>
|
||||
<Settings />
|
||||
User Settings
|
||||
</DropdownMenuItem>
|
||||
</RouterLink>
|
||||
<DropdownMenuItem onClick={handleLogout}>
|
||||
<LogOut />
|
||||
Log Out
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user