Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

1.4 KB
Raw Blame
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createElement, type ReactNode } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";

/*
 * Home's "Studios and tools" section is the pattern every area page (/create, /studios…) repeats. The area pages share
 * its component, and Home must look exactly as it did: its markup is pinned here.
 */

vi.mock("next/cache", () => ({ cacheLife: () => {} }));
vi.mock("next/navigation", () => ({
  useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),
  usePathname: () => "/",
  useSearchParams: () => new URLSearchParams(),
}));

const { StudiosSection } = await import("@/components/home/home-sections");
const { homeShowcase } = await import("@/lib/home-showcase");

const render = (node: ReactNode) => renderToStaticMarkup(createElement(QueryClientProvider, { client: new QueryClient() }, node));

describe("Home's Studios and tools", () => {
  it("renders the same markup as before the area pages shared it", async () => {
    const home = await homeShowcase();
    const html = render(createElement(StudiosSection, { facts: home.facts, studios: home.studios, audioTools: home.audioTools, pills: home.pills }));
    await expect(html.replace(/></g, ">\n<")).toMatchFileSnapshot("__snapshots__/home-studios.html");
  });
});