summaryrefslogtreecommitdiff
path: root/scripts/test.sh
diff options
context:
space:
mode:
authorJohn Bargman2026-04-15 08:23:09 +0000
committerJohn Bargman2026-04-15 08:23:09 +0000
commitdb6b79edbfca3ab7049af2492acd567b099559f5 (patch)
treef54df4a8af70b057032e5af882bd6d1e6be87bf2 /scripts/test.sh
parent4f877207787edd592687f338772d95c9ec2c7038 (diff)
downloadnixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar.gz
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar.bz2
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar.lz
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar.xz
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.tar.zst
nixtaml-website-db6b79edbfca3ab7049af2492acd567b099559f5.zip
agentic ai; is so; fucking cool; omgmain
Diffstat (limited to 'scripts/test.sh')
-rwxr-xr-xscripts/test.sh111
1 files changed, 111 insertions, 0 deletions
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 0000000..a66915e
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,111 @@
+#!/run/current-system/sw/bin/bash
+
+# Test script for Nixtaml single-page website
+# Checks file references and basic HTML structure
+
+echo "=== Nixtaml Website Integration Test ==="
+
+# Base directory
+BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+INDEX_FILE="$BASE_DIR/index.html"
+
+# Check if index.html exists
+if [ ! -f "$INDEX_FILE" ]; then
+ echo "ERROR: index.html not found at $INDEX_FILE"
+ exit 1
+fi
+
+echo "Checking file references in index.html..."
+
+# Extract src attributes from script tags
+SCRIPT_FILES=$(grep -oP 'src="\K[^"]+' "$INDEX_FILE")
+# Extract href from link tags, excluding anchors
+LINK_FILES=$(grep -oP 'href="\K[^"#][^"]*' "$INDEX_FILE")
+
+# Combine and deduplicate
+ALL_FILES=$(echo -e "$SCRIPT_FILES\n$LINK_FILES" | sort | uniq)
+
+MISSING_FILES=()
+for file in $ALL_FILES; do
+ # Skip external URLs (starting with http)
+ if [[ $file == http* ]]; then
+ continue
+ fi
+
+ # Check if file exists relative to BASE_DIR
+ if [ ! -f "$BASE_DIR/$file" ]; then
+ MISSING_FILES+=("$file")
+ fi
+done
+
+# Report missing files
+if [ ${#MISSING_FILES[@]} -gt 0 ]; then
+ echo "ERROR: Missing referenced files:"
+ for file in "${MISSING_FILES[@]}"; do
+ echo " - $file"
+ done
+else
+ echo "✓ All referenced files exist"
+fi
+
+# Basic HTML structure validation
+echo "Validating basic HTML structure..."
+
+# Check for required elements
+if ! grep -q "<!DOCTYPE html>" "$INDEX_FILE"; then
+ echo "WARNING: Missing DOCTYPE declaration"
+fi
+
+if ! grep -q "<html" "$INDEX_FILE"; then
+ echo "ERROR: Missing <html> tag"
+fi
+
+if ! grep -q "</html>" "$INDEX_FILE"; then
+ echo "ERROR: Missing </html> closing tag"
+fi
+
+if ! grep -q "<head>" "$INDEX_FILE"; then
+ echo "ERROR: Missing <head> tag"
+fi
+
+if ! grep -q "<body>" "$INDEX_FILE"; then
+ echo "ERROR: Missing <body> tag"
+fi
+
+# Check for balanced tags (basic check)
+OPEN_TAGS=$(grep -o '<[^/][^>]*>' "$INDEX_FILE" | wc -l)
+CLOSE_TAGS=$(grep -o '</[^>]*>' "$INDEX_FILE" | wc -l)
+
+if [ "$OPEN_TAGS" -ne "$CLOSE_TAGS" ]; then
+ echo "WARNING: Potential unbalanced tags (open: $OPEN_TAGS, close: $CLOSE_TAGS)"
+else
+ echo "✓ Basic tag balance looks good"
+fi
+
+# Check for required sections
+REQUIRED_SECTIONS=("home" "install" "cookbook" "docs" "community")
+for section in "${REQUIRED_SECTIONS[@]}"; do
+ if ! grep -q "id=\"$section\"" "$INDEX_FILE"; then
+ echo "ERROR: Missing section with id=\"$section\""
+ fi
+done
+
+echo "✓ Section IDs present"
+
+# Check for WebGL canvas insertion point
+if ! grep -q "webgl-bg.js" "$INDEX_FILE"; then
+ echo "WARNING: webgl-bg.js not referenced - WebGL background may not load"
+fi
+
+if ! grep -q "parallax.js" "$INDEX_FILE"; then
+ echo "WARNING: parallax.js not referenced - Parallax effects may not work"
+fi
+
+echo "=== Test Complete ==="
+
+if [ ${#MISSING_FILES[@]} -gt 0 ]; then
+ echo "FAIL: Issues found"
+ exit 1
+else
+ echo "PASS: All checks passed"
+fi \ No newline at end of file