diff --git a/Makefile b/Makefile index 6d9b1c4..91b669e 100644 --- a/Makefile +++ b/Makefile @@ -39,9 +39,7 @@ test-rebuild: @. scripts/test-env.sh; \ mkdir -p data/test; \ rm -f "$$TT_TEST_DB"; \ - for f in backend/migrations/*.sql; do sqlite3 "$$TT_TEST_DB" < $$f; done; \ - sqlite3 "$$TT_TEST_DB" < backend/demo/demo_seed.sql; \ - echo "[test-rebuild] DB ready at $$TT_TEST_DB" + echo "[test-rebuild] DB wiped at $$TT_TEST_DB" test-up: @. scripts/test-env.sh; \ @@ -58,8 +56,10 @@ test-up: curl -fs "$$TT_BASE_URL/health" >/dev/null 2>&1 && break; \ sleep 1; \ done; \ - curl -fs "$$TT_BASE_URL/health" >/dev/null || (echo "[test-up] Backend failed to start; see /tmp/tutortool-test.log" && exit 1); \ - echo "[test-up] Ready at $$TT_BASE_URL" + curl -fs "$$TT_BASE_URL/health" >/dev/null 2>&1 || (echo "[test-up] Backend failed to start; see /tmp/tutortool-test.log" && exit 1); \ + $(MAKE) test-reset; \ + echo "[test-up] Backend ready on $$TT_BASE_URL" + test-down: @. scripts/test-env.sh; \ diff --git a/backend/demo/demo_seed.sql b/backend/demo/demo_seed.sql index 68170c5..1aebdc4 100644 --- a/backend/demo/demo_seed.sql +++ b/backend/demo/demo_seed.sql @@ -14,13 +14,30 @@ VALUES (1, 1); -- Rooms INSERT OR IGNORE INTO rooms (id, name, layout_json) VALUES (1, 'Room A (Small)', '[ - {"id": "t1", "label": "T1", "x": 100, "y": 100, "width": 120, "height": 60, "type": "table"}, - {"id": "s1", "label": "1", "x": 110, "y": 110, "width": 40, "height": 40, "type": "seat"}, - {"id": "s2", "label": "2", "x": 170, "y": 110, "width": 40, "height": 40, "type": "seat"}, - {"id": "t2", "label": "T2", "x": 300, "y": 100, "width": 120, "height": 60, "type": "table"}, - {"id": "s3", "label": "3", "x": 310, "y": 110, "width": 40, "height": 40, "type": "seat"}, - {"id": "s4", "label": "4", "x": 370, "y": 110, "width": 40, "height": 40, "type": "seat"}, - {"id": "d1", "label": "Door", "x": 10, "y": 10, "width": 60, "height": 10, "type": "door"} + { "id": "T1", "label": "T1", "x": 90, "y": 150, "width": 200, "height": 70, "type": "table" }, + { "id": "T2", "label": "T2", "x": 470, "y": 150, "width": 200, "height": 70, "type": "table" }, + { "id": "T3", "label": "T3", "x": 90, "y": 320, "width": 200, "height": 70, "type": "table" }, + { "id": "T4", "label": "T4", "x": 470, "y": 320, "width": 200, "height": 70, "type": "table" }, + { "id": "T1-1", "label": "1", "x": 146.0, "y": 128, "width": 36, "height": 36, "type": "seat" }, + { "id": "T1-2", "label": "2", "x": 234.0, "y": 128, "width": 36, "height": 36, "type": "seat" }, + { "id": "T1-3", "label": "3", "x": 146.0, "y": 242, "width": 36, "height": 36, "type": "seat" }, + { "id": "T1-4", "label": "4", "x": 234.0, "y": 242, "width": 36, "height": 36, "type": "seat" }, + { "id": "T1-5", "label": "5", "x": 316, "y": 185.0, "width": 36, "height": 36, "type": "seat" }, + { "id": "T2-1", "label": "1", "x": 526.0, "y": 128, "width": 36, "height": 36, "type": "seat" }, + { "id": "T2-2", "label": "2", "x": 614.0, "y": 128, "width": 36, "height": 36, "type": "seat" }, + { "id": "T2-3", "label": "3", "x": 526.0, "y": 242, "width": 36, "height": 36, "type": "seat" }, + { "id": "T2-4", "label": "4", "x": 614.0, "y": 242, "width": 36, "height": 36, "type": "seat" }, + { "id": "T2-5", "label": "5", "x": 696, "y": 185.0, "width": 36, "height": 36, "type": "seat" }, + { "id": "T3-1", "label": "1", "x": 146.0, "y": 298, "width": 36, "height": 36, "type": "seat" }, + { "id": "T3-2", "label": "2", "x": 234.0, "y": 298, "width": 36, "height": 36, "type": "seat" }, + { "id": "T3-3", "label": "3", "x": 146.0, "y": 412, "width": 36, "height": 36, "type": "seat" }, + { "id": "T3-4", "label": "4", "x": 234.0, "y": 412, "width": 36, "height": 36, "type": "seat" }, + { "id": "T3-5", "label": "5", "x": 316, "y": 355.0, "width": 36, "height": 36, "type": "seat" }, + { "id": "T4-1", "label": "1", "x": 526.0, "y": 298, "width": 36, "height": 36, "type": "seat" }, + { "id": "T4-2", "label": "2", "x": 614.0, "y": 298, "width": 36, "height": 36, "type": "seat" }, + { "id": "T4-3", "label": "3", "x": 526.0, "y": 412, "width": 36, "height": 36, "type": "seat" }, + { "id": "T4-4", "label": "4", "x": 614.0, "y": 412, "width": 36, "height": 36, "type": "seat" }, + { "id": "T4-5", "label": "5", "x": 696, "y": 355.0, "width": 36, "height": 36, "type": "seat" } ]'); -- Students