diff options
Diffstat (limited to 'test/db/drafts.sql')
-rw-r--r-- | test/db/drafts.sql | 15 |
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; + |