The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
use Test::More tests => 3;

use ObjectDB::Relationship::OneToOne;

use lib 't/lib';

my $rel = ObjectDB::Relationship::OneToOne->new(
    name       => 'article',
    type       => 'one to one',
    orig_class => 'Author',
    class      => 'Article',
    map        => {id => 'author_id'},
    join_args  => [title => 'foo', content => 'bar']
);
ok($rel);

is($rel->related_table, 'article');

is_deeply(
    $rel->to_source,
    {   name       => 'article',
        join       => 'left',
        as         => 'article',
        constraint => [
            'article.author_id' => 'author.id',
            'article.title'   => 'foo',
            'article.content' => 'bar'
        ]
    }
);