chipilov
01/03/2022, 6:11 PM1..2
# Subtest: private.test_1()
ok 1 - Should have no logs
ok 2 - Should have haha 1
1..2
ok 1 - private.test_1
# Subtest: private.test_2()
ok 1 - Should have no logs
ok 2 - Should have haha 2
1..2
ok 2 - private.test_2
tourdownunder
01/05/2022, 5:55 AMreturn next
for it to work
sql
BEGIN;
select *
from plan(2);
CREATE OR REPLACE FUNCTION tests() RETURNS SETOF TEXT AS
$do$
declare
my_name text;
BEGIN
SET client_min_messages TO notice;
my_name := 'tourdownunder';
return next is((select 'done'::text),
'done', 'check job ran successfully');
return next results_eq($$select 'tourdownunder' $$, 'select ''tourdownunder''', 'test');
end
$do$ language plpgsql;
select *
from tests();
ROLLBACK;
chipilov
01/05/2022, 8:09 AMCREATE OR REPLACE FUNCTION test.test_invalid_user_creation_request()
RETURNS SETOF TEXT
AS $$
BEGIN
RETURN NEXT
throws_ok(
'SELECT public.create_user_profile(''{ "haha": 1 }'')',
'P0001',
'Invalid request data for create_user_profile',
'Profile creation should throw on malformed JSON'
);
END
$$
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = private, extensions, pg_temp;
SELECT * from runtests('test'::name); -- my test functions are in the test schema
# Subtest: test.test_invalid_user_creation_request()
ok 1 - Profile creation should throw on malformed JSON
1..1
ok 1 - test.test_invalid_user_creation_request
# Subtest: test.test_valid_user_creation_request()
ok 1 - user profile should contain the newly created user profile
1..1
ok 2 - test.test_valid_user_creation_request
1..2
1..2
ok 1 - test.test_invalid_user_creation_request
# Subtest: test.test_valid_user_creation_request()
ok 1 - user profile should contain the newly created user profile
1..1
ok 2 - test.test_valid_user_creation_request
# Subtest: test.test_invalid_user_creation_request()
ok 1 - Profile creation should throw on malformed JSON
1..1