UNPKG

create-dynamic-app

Version:

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

55 lines (46 loc) 1.72 kB
import { describe, it, expect } from "bun:test" import { useDarkMode } from "../../next-templates/darkMode" import { generateDynamicLibContent } from "../../next-templates/dynamic" describe("Hooks and Configuration", () => { describe("Dark Mode Hook", () => { it("should generate correct dark mode hook", () => { const content = useDarkMode // Check for imports expect(content).toContain('import { useState, useEffect } from "react"') // Check for hook implementation expect(content).toContain("export function useDarkMode()") expect(content).toContain("const [isDarkMode, setIsDarkMode] = useState") expect(content).toContain("checkIsDarkSchemePreferred") }) }) describe("Dynamic Configuration", () => { const mockChains = [ { name: "Ethereum", package: "@dynamic-labs/ethereum", connector: "EthereumWalletConnectors", }, ] describe("Ethereum with Viem", () => { it("should generate correct dynamic configuration", () => { const content = generateDynamicLibContent(true, true, [mockChains[0]]) // Check for exports expect(content).toContain( 'export * from "@dynamic-labs/sdk-react-core"' ) expect(content).toContain('export * from "@dynamic-labs/ethereum"') }) }) describe("Ethereum with Ethers", () => { it("should generate correct dynamic configuration", () => { const content = generateDynamicLibContent(false, false, [mockChains[0]]) // Check for exports expect(content).toContain( 'export * from "@dynamic-labs/sdk-react-core"' ) expect(content).toContain('export * from "@dynamic-labs/ethers-v6"') expect(content).toContain('export * from "@dynamic-labs/ethereum"') }) }) }) })