### ----------------------------------------------------
### -- Ecosystem
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use Ecosystem;

plan 16;

my $eco := Ecosystem.new;
isa-ok $eco, Ecosystem;
is $eco.ecosystem, 'rea', 'is the ecosystem name ok';

my $short-name := "eigenstates";
my $auth     := "zef:lizmat";
my $auth-url := "zef%3Alizmat";
my $ver      := '0.0.11';
my $identity := $short-name ~ ":ver<$ver>:auth<$auth>";

my $found := $eco.find-identities($short-name, :$ver, :$auth).head;
is $found, $identity, 'is identity ok';

is $eco.identity-url($identity),
  "https://raw.githubusercontent.com/raku/REA/main/archive/E/eigenstates/eigenstates%3Aver%3C$ver%3E%3Aauth%3C$auth-url%3E.tar.gz",
  'is identity-url ok?';

is $eco.use-targets<eigenstates>.head, $identity,
  'is use-target ok?';

is $eco.identity-url($identity),
  "https://raw.githubusercontent.com/raku/REA/main/archive/E/eigenstates/eigenstates%3Aver%3C$ver%3E%3Aauth%3C$auth-url%3E.tar.gz",
  'is distro-url ok?';

is-deeply $eco.identity-release-Date($identity), Date.new(2024,6,24),
  'is identity-release-Date ok?';
is-deeply $eco.identity-release-yyyy-mm-dd($identity), "2024-06-24",
  'is identity-release-yyyy-mm-dd ok?';

is-deeply $eco.distros-of-use-target($short-name), ($short-name,),
  'is distros-of-use-target ok?';

isa-ok $eco.least-recent-release, Date,
  'is least-recent-release a Date?';
isa-ok $eco.most-recent-release, Date,
  'is most-recent-release a Date?';

is $eco.resolve("eigenstates"), $identity, 'is resolve ok?';

is-deeply $eco.find-no-tags("eigenstates"), (), 'eigenstates has tags';

is $eco.tags<eigenstates>.head.head, $identity, 'found the EIGENSTATES tag';

ok $identity (elem) $eco.authors<mattijsen>.head<>,
  'found the author';

is $eco.release-dates("2024-06-24").head.tail, $identity,
  'found the release by date';

# vim: expandtab shiftwidth=4


