#!/usr/bin/env bash echo "๐Ÿงช Testing Nix Web Development Setup..." echo "=======================================" # Test if nix-instantiate can evaluate our test file echo "๐Ÿ“‹ Running syntax validation..." if nix-instantiate --eval --json test-build.nix > /dev/null 2>&1; then echo "โœ… Nix syntax validation passed" else echo "โŒ Nix syntax validation failed" echo "Error details:" nix-instantiate --eval --json test-build.nix exit 1 fi # Test component evaluation echo "๐Ÿ”ง Testing component system..." nix-instantiate --eval --json --expr ' let pkgs = import {}; html = import ./src/core/html.nix { inherit pkgs; }; css = import ./src/core/css.nix { inherit pkgs; }; components = import ./src/core/components.nix { inherit pkgs html css; }; in { componentCount = builtins.length (builtins.attrNames components); hasHeader = builtins.hasAttr "terminalHeader" components; hasHero = builtins.hasAttr "heroSection" components; }' | jq '.' # Test page generation echo "๐Ÿ“„ Testing page generation..." nix-instantiate --eval --json --expr ' let pkgs = import {}; html = import ./src/core/html.nix { inherit pkgs; }; css = import ./src/core/css.nix { inherit pkgs; }; components = import ./src/core/components.nix { inherit pkgs html css; }; content = import ./src/data/content.nix; page = import ./src/pages/index.nix { inherit components content; }; in { hasHtml = builtins.isString page.html; htmlLength = builtins.stringLength page.html; }' | jq '.' # Test CSS generation echo "๐ŸŽจ Testing CSS generation..." nix-instantiate --eval --json --expr ' let styles = import ./src/styles/main.nix; in { hasCss = builtins.isString styles.css; cssLength = builtins.stringLength styles.css; }' | jq '.' echo "" echo "๐ŸŽ‰ All tests completed!" echo "๐Ÿ’ก Run 'generate-site' to build the full website"