import std/[os, strutils, unittest]
import ../src/luxtools
const indexTemplate = staticRead("../src/templates/index.html")
suite "rendering helpers":
test "counter markup references hx attributes":
let html = renderCounter(3)
check html.contains("hx-post=\"/counter\"")
check html.contains("id=\"counter\"")
check html.contains("3")
test "index template uses embedded htmx build":
check indexTemplate.contains("/static/lib/htmx.2.0.7.min.js")
check indexTemplate.contains("")
check indexTemplate.contains("/static/lib/tuicss/tuicss.min.css")
check indexTemplate.contains("href=\"/static/lib/tuicss/tuicss.min.css\"")
check indexTemplate.contains("")
check not indexTemplate.contains("unpkg.com/htmx")
check not indexTemplate.contains("unpkg.com/tui-css")
test "demo asset lives in assets directory":
let assetPath = joinPath(getAppDir(), "..", "assets", "demo.txt")
check fileExists(assetPath)