UNPKG

create-dynamic-app

Version:

CLI tool to generate sample applications using Dynamic's web3 authentication

65 lines (52 loc) 2.25 kB
import { describe, it, expect } from "bun:test" import { generateLayoutContent } from "../../next-templates/layout" import { pageContent } from "../../next-templates/page" import type { Chain } from "../../types" describe("Layout and Page Generation", () => { describe("Layout Generation", () => { it("should generate correct layout imports", () => { const content = generateLayoutContent() expect(content).toContain('import "./globals.css"') expect(content).toContain('import type { Metadata } from "next"') expect(content).toContain('import { Inter } from "next/font/google"') expect(content).toContain('import Providers from "@/lib/providers"') }) it("should include proper metadata", () => { const content = generateLayoutContent() expect(content).toContain('title: "Create Dynamic App"') expect(content).toContain( 'description: "Generated by create dynamic app"' ) }) it("should include proper font configuration", () => { const content = generateLayoutContent() expect(content).toContain('const inter = Inter({ subsets: ["latin"] })') }) it("should include proper layout structure", () => { const content = generateLayoutContent() expect(content).toContain("export default function RootLayout") expect(content).toContain('<html lang="en">') expect(content).toContain("<body className={inter.className}>") expect(content).toContain("<Providers>{children}</Providers>") }) }) describe("Page Generation", () => { it("should include proper page structure", () => { const content = pageContent // Check for imports expect(content).toContain('import { DynamicWidget } from "@/lib/dynamic"') expect(content).toContain('import { useState, useEffect } from "react"') expect(content).toContain( 'import DynamicMethods from "@/app/components/Methods"' ) // Check for components expect(content).toContain("export default function Main()") expect(content).toContain("<DynamicWidget />") expect(content).toContain("<DynamicMethods") // Check for structure expect(content).toContain('<div className="header">') expect(content).toContain('<div className="modal">') expect(content).toContain('<div className="footer">') }) }) })