-- Test currency
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;

begin;

select plan(20);

set search_path to numerus, public;

select has_table('currency');
select has_pk('currency');
select table_privs_are('currency', 'guest', array []::text[]);
select table_privs_are('currency', 'invoicer', array ['SELECT']);
select table_privs_are('currency', 'admin', array ['SELECT']);
select table_privs_are('currency', 'authenticator', array []::text[]);

select has_column('currency', 'currency_code');
select col_is_pk('currency', 'currency_code');
select col_type_is('currency', 'currency_code', 'currency_code');
select col_not_null('currency', 'currency_code');
select col_hasnt_default('currency', 'currency_code');

select has_column('currency', 'currency_symbol');
select col_type_is('currency', 'currency_symbol', 'text');
select col_not_null('currency', 'currency_symbol');
select col_hasnt_default('currency', 'currency_symbol');

select has_column('currency', 'decimal_digits');
select col_type_is('currency', 'decimal_digits', 'integer');
select col_not_null('currency', 'decimal_digits');
select col_has_default('currency', 'decimal_digits');
select col_default_is('currency', 'decimal_digits', 2);


select finish();
rollback;
