From 6bd24af2ffbea91db1b10a5d5258980ce2068c7f Mon Sep 17 00:00:00 2001
From: sadbeast <sadbeast@sadbeast.com>
Date: Tue, 16 Jul 2024 18:16:29 -0700
Subject: let's go

---
 test/db/scores.sql | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 test/db/scores.sql

(limited to 'test/db/scores.sql')

diff --git a/test/db/scores.sql b/test/db/scores.sql
new file mode 100644
index 0000000..2e1fee3
--- /dev/null
+++ b/test/db/scores.sql
@@ -0,0 +1,19 @@
+BEGIN;
+SELECT plan(2);
+
+SELECT has_table('scores');
+SELECT has_table('score_categories');
+
+SELECT league_id AS nfl_league_id FROM leagues WHERE name = 'NFL' LIMIT 1 \gset
+INSERT INTO seasons (league_id, started_at, ended_at) VALUES (:nfl_league_id, now() - interval '1 day', now() + interval '3 months') RETURNING season_id new_season_id \gset
+
+SELECT league_id AS nfl_league_id FROM leagues WHERE name = 'NFL' LIMIT 1 \gset
+SELECT team_id AS seattle FROM teams JOIN league_divisions USING (league_division_id) WHERE teams.name = 'Seattle' AND league_id = :nfl_league_id \gset
+SELECT team_id AS buffalo FROM teams JOIN league_divisions USING (league_division_id) WHERE teams.name = 'Buffalo' AND league_id = :nfl_league_id \gset
+
+SELECT record_score(:seattle, 1, :new_season_id, 1, now());
+SELECT record_score(:seattle, 2, :new_season_id, 1, now());
+SELECT record_score(:buffalo, 2, :new_season_id, 1, now());
+
+SELECT * FROM finish();
+ROLLBACK;
-- 
cgit v1.2.3

