all repos — bibel @ master

Unnamed repository; edit this file 'description' to name the repository.

build/test/smoke_test.sh (view raw)

 1#!/bin/bash
 2
 3# bibel Smoke Test
 4# Quick test to verify date progression is working
 5
 6set -e
 7
 8echo "🔍 bibel Smoke Test - $(date)"
 9echo "========================================"
10
11# Build if needed
12if [ ! -f bibel ]; then
13  echo "Building bibel..."
14  go build -o bibel ./cmd/bibel.go
15fi
16
17# Test 1: All reading modes should work
18echo "📖 Test 1: Reading Modes"
19MODES=("evangelion" "new_testament" "old_testament" "bible")
20for mode in "${MODES[@]}"; do
21  echo -n "  Testing $mode... "
22  if timeout 2 ./bibel --plain -r "$mode" >/dev/null 2>&1; then
23    echo "✅"
24  elif [ $? -eq 124 ]; then
25    echo "⏱️  (timeout - TUI mode)"
26  else
27    echo "❌ FAILED"
28    exit 1
29  fi
30done
31
32# Test 2: Date progression should produce today's verses
33echo "📅 Test 2: Today's Reading"
34TODAY_OUTPUT=$(./bibel --plain -r evangelion 2>/dev/null || true)
35if [ -n "$TODAY_OUTPUT" ]; then
36  echo "  Today's reading:"
37  echo "$TODAY_OUTPUT" | head -3 | sed 's/^/    /'
38  echo "  ✅ Output generated"
39else
40  echo "  ❌ No output generated"
41  exit 1
42fi
43
44# Test 3: Check verse count (should be around 12 verses)
45echo "🔢 Test 3: Verse Count"
46# Count approximate verses by counting period+space patterns
47VERSE_COUNT=$(echo "$TODAY_OUTPUT" | tr '.' '\n' | wc -l)
48echo "  Approximate verses detected: $VERSE_COUNT"
49if [ "$VERSE_COUNT" -ge 5 ]; then # Somewhat lenient
50  echo "  ✅ Reasonable verse count"
51else
52  echo "  ⚠️  Low verse count, but may be OK"
53fi
54
55# Test 4: Different modes should show different books
56echo "📚 Test 4: Mode Differentiation"
57EV_OUTPUT=$(./bibel --plain -r evangelion 2>/dev/null | head -1)
58OT_OUTPUT=$(./bibel --plain -r old_testament 2>/dev/null | head -1)
59
60if [ "$EV_OUTPUT" != "$OT_OUTPUT" ]; then
61  echo "  ✅ Different modes show different books"
62  echo "    evangelion: $EV_OUTPUT"
63  echo "    old_testament: $OT_OUTPUT"
64else
65  echo "  ❌ Modes show same book!"
66  exit 1
67fi
68
69echo "========================================"
70echo "✅ All smoke tests PASSED"
71echo "💡 Next: Run 'make test' for comprehensive tests"
72exit 0