Adding functional test of database integration.

Since the project is not functional still I made the changes
needed in database in order of it to work directly over the
creation migration.
This commit is contained in:
sergiotarxz 2022-03-15 17:41:42 +01:00
parent 94eafe55a2
commit 156e69c825
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,43 @@
#!/usr/bin/env perl
use v5.30.0;
use strict;
use warnings;
use Test::Most tests => 2;
use DateTime;
use Peace;
use Peace::DB;
use Peace::Model::Developer;
use Peace::DAO::Developer;
{
## GIVEN
my $current_date = DateTime->now;
my $peace = Peace->new;
my $home = $ENV{HOME};
my $config =
$peace->plugin(
JSONConfig => { file => "$home/.config/peace/peace.conf" } );
my $dbh = Peace::DB->dbh( config => $config );
my $secret_bcrypt = 'hola';
my $developer = Peace::Model::Developer->new(
name => 'Larry',
surname => 'Wall',
email => 'larry@perl.org',
country => 'US',
verified => 0,
secret_bcrypt => $secret_bcrypt
);
my $developer_dao = Peace::DAO::Developer->new( dbh => $dbh );
## WHEN
$developer_dao->create( developer => $developer );
## THEN
ok $developer->uuid, 'Generated uuid.';
ok $developer->date_creation > $current_date, 'The date is recent.';
}

View File

@ -31,7 +31,7 @@ my @migrations = (
name TEXT NOT NULL,
surname TEXT NOT NULL,
email TEXT NOT NULL,
stripe_id TEXT NOT NULL,
stripe_id TEXT,
country TEXT NOT NULL,
verified BOOL DEFAULT false,
PRIMARY KEY (uuid)