diff options
Diffstat (limited to 'integration/apps/bun-dev-index-html.sh')
-rw-r--r-- | integration/apps/bun-dev-index-html.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/integration/apps/bun-dev-index-html.sh b/integration/apps/bun-dev-index-html.sh new file mode 100644 index 000000000..44322eeec --- /dev/null +++ b/integration/apps/bun-dev-index-html.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -euo pipefail + +killall -9 $(basename $BUN_BIN) || echo "" + +dir=$(mktemp -d --suffix=bun-dev-check) + +index_content="<html><body>index.html</body></html>" +bacon_content="<html><body>bacon.html</body></html>" +js_content="console.log('hi')" + +echo $index_content >"$dir/index.html" +echo $js_content >"$dir/index.js" +echo $bacon_content >"$dir/bacon.html" + +cd $dir + +$BUN_BIN --port 8087 & +sleep 0.005 + +if [ "$(curl --fail http://localhost:8087/)" != "$index_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/)'" + exit 1 +fi + +if [ "$(curl --fail http://localhost:8087/index)" != "$index_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index)'" + exit 1 +fi + +if [ "$(curl --fail http://localhost:8087/index.html)" != "$index_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index.html)'" + exit 1 +fi + +if [ "$(curl --fail http://localhost:8087/foo/foo)" != "$index_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/index.html)'" + exit 1 +fi + +if [ "$(curl --fail http://localhost:8087/bacon)" != "$bacon_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/bacon)'" + exit 1 +fi + +if [ "$(curl --fail http://localhost:8087/bacon.html)" != "$bacon_content" ]; then + echo "ERR: Expected '$index_content', got '$(curl --fail http://localhost:8087/bacon.html)'" + exit 1 +fi + +killall -9 $(basename $BUN_BIN) || echo "" +echo "✅ bun dev index html check passed." |