chore: Adding unit tests for UI

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
Francisco Javier Arceo 2025-08-18 14:12:39 -04:00
parent 5e7c2250be
commit db96b10d4d
2 changed files with 10 additions and 1 deletions

View file

@ -52,8 +52,10 @@ export default function ContentsListPage() {
const [file, setFile] = useState<VectorStoreFile | null>(null); const [file, setFile] = useState<VectorStoreFile | null>(null);
const [contents, setContents] = useState<VectorStoreContentItem[]>([]); const [contents, setContents] = useState<VectorStoreContentItem[]>([]);
const [isLoadingStore, setIsLoadingStore] = useState(true); const [isLoadingStore, setIsLoadingStore] = useState(true);
const [isLoadingFile, setIsLoadingFile] = useState(true);
const [isLoadingContents, setIsLoadingContents] = useState(true); const [isLoadingContents, setIsLoadingContents] = useState(true);
const [errorStore, setErrorStore] = useState<Error | null>(null); const [errorStore, setErrorStore] = useState<Error | null>(null);
const [errorFile, setErrorFile] = useState<Error | null>(null);
const [errorContents, setErrorContents] = useState<Error | null>(null); const [errorContents, setErrorContents] = useState<Error | null>(null);
useEffect(() => { useEffect(() => {
@ -175,7 +177,13 @@ export default function ContentsListPage() {
<CardTitle>Content Chunks ({contents.length})</CardTitle> <CardTitle>Content Chunks ({contents.length})</CardTitle>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
{isLoadingContents ? ( {isLoadingFile ? (
<Skeleton className="h-4 w-full" />
) : errorFile ? (
<div className="text-destructive text-sm">
Error loading file: {errorFile.message}
</div>
) : isLoadingContents ? (
<div className="space-y-2"> <div className="space-y-2">
<Skeleton className="h-4 w-full" /> <Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-3/4" /> <Skeleton className="h-4 w-3/4" />

View file

@ -187,6 +187,7 @@ const COMPONENTS = {
code: ({ code: ({
children, children,
className, className,
...rest
}: { }: {
children: React.ReactNode; children: React.ReactNode;
className?: string; className?: string;