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

begin;

select plan(24);

set search_path to camper, public;

select has_table('currency');
select has_pk('currency' );
select table_privs_are('currency', 'guest', array ['SELECT']);
select table_privs_are('currency', 'employee', 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 has_column('currency', 'redsys_code');
select col_type_is('currency', 'redsys_code', 'integer');
select col_not_null('currency', 'redsys_code');
select col_hasnt_default('currency', 'redsys_code');


select *
from finish();

rollback;

