summaryrefslogtreecommitdiffstats
path: root/test/db/drafts.sql
diff options
context:
space:
mode:
authorsadbeast <sadbeast@sadbeast.com>2024-07-16 18:16:29 -0700
committersadbeast <sadbeast@sadbeast.com>2024-10-05 16:40:55 -0700
commit6bd24af2ffbea91db1b10a5d5258980ce2068c7f (patch)
tree66634833f2d45260be5fcaf9111400eda12f03cc /test/db/drafts.sql
downloadteamdraft-main.tar.gz
teamdraft-main.tar.bz2
let's goHEADmain
Diffstat (limited to 'test/db/drafts.sql')
-rw-r--r--test/db/drafts.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/db/drafts.sql b/test/db/drafts.sql
new file mode 100644
index 0000000..1e63362
--- /dev/null
+++ b/test/db/drafts.sql
@@ -0,0 +1,15 @@
+BEGIN;
+SELECT plan(5);
+
+SELECT has_table('drafts');
+SELECT columns_are('drafts', ARRAY[ 'draft_id', 'season_id', 'draft_status_id', 'name', 'account_id', 'started_at', 'modified_at', 'created_at']);
+SELECT has_sequence('drafts_draft_id_seq');
+SELECT has_index('teamdraft', 'drafts', 'drafts_pk', 'draft_id');
+
+INSERT INTO seasons (league_id, started_at, ended_at) VALUES (1, now() - interval '1 day', now() + interval '3 months') RETURNING season_id new_season_id \gset
+SELECT create_draft(1, 'sadbeast', 'freckles', now() + interval '3 days') new_session_id \gset
+SELECT is(1, (SELECT count(1)::int FROM account_active_session_keys WHERE session_id = :'new_session_id'));
+
+SELECT * FROM finish();
+ROLLBACK;
+