34 lines
640 B
MySQL
34 lines
640 B
MySQL
|
-- Test email
|
||
|
set client_min_messages to warning;
|
||
|
create extension if not exists pgtap;
|
||
|
reset client_min_messages;
|
||
|
|
||
|
begin;
|
||
|
|
||
|
select plan(5);
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
select has_domain('email');
|
||
|
select domain_type_is('email', 'citext');
|
||
|
|
||
|
select lives_ok($$ select 'test@tandem.com'::email $$, 'Should be able to cast strings to email');
|
||
|
|
||
|
select throws_ok(
|
||
|
$$ SELECT 'test@tandem,,co.uk'::email $$,
|
||
|
23514, null,
|
||
|
'Should reject email addresses with wrong domain'
|
||
|
);
|
||
|
|
||
|
select throws_ok(
|
||
|
$$ SELECT 'test@a@tandem.com'::email $$,
|
||
|
23514, null,
|
||
|
'Should reject email address with two @ signs'
|
||
|
);
|
||
|
|
||
|
|
||
|
select *
|
||
|
from finish();
|
||
|
|
||
|
rollback;
|