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

use Text::Emoji;

plan 17;

my %direct   is Map = :love<❤️>;
my %indirect is Map = :love<heart>;

is to-emoji(":I: :heart: :beer:"),
  ":I: ❤️ 🍺",
  "it works!";
is to-emoji(":I: :love: :beer:", %direct),
  ":I: ❤️ 🍺",
  "it works with direct additional!";
is to-emoji(":I: :love: :beer:", %indirect),
  ":I: ❤️ 🍺",
  "it works with indirect additional!";
is to-emoji(":I: :love: :beer:", :love<❤️>),
  ":I: ❤️ 🍺",
  "it works with named direct additional!";
is to-emoji(":I: :love: :beer:", :love<heart>),
  ":I: ❤️ 🍺",
  "it works with named indirect additional!";

is to-emoji("ok :+1:, not-ok :-1:"),
  "ok 👍, not-ok 👎",
  "all ok not ok ok";

is to-emoji("baby: :BABY-BOTTLE::babybottle:"),
  "baby: 🍼🍼",
  "all babies ok";

is to-text(":I: ❤️ 🍺"),
  ":I: :heart: :beer:",
  "it works in reverse!";
is to-text(":I: ❤️ 🍺", %direct),
  ":I: :love: :beer:",
  "it works in reverse with direct additional!";
is to-text(":I: ❤️ 🍺", %indirect),
  ":I: :love: :beer:",
  "it works in reverse with indirect additional!";
is to-text(":I: ❤️ 🍺", :love<❤️>),
  ":I: :love: :beer:",
  "it works in reverse with named direct additional!";
is to-text(":I: ❤️ 🍺", :love<heart>),
  ":I: :love: :beer:",
  "it works in reverse with named indirect additional!";

my $clean = "A clean string with : but without emojis";
is to-emoji($clean), $clean, 'no text , still clean';
is to-text( $clean), $clean, 'no emoji , still clean';

my $raw := raw-emoji-data;
isa-ok $raw, Map, 'the raw data comes as a Map';
is $raw.elems, 1870, 'does the raw data have correct size';
is-deeply $raw<❤️ >,
  (:aliases($["heart"]),
    :category("Smileys \& Emotion"),
    :description("red heart"),
    :ios_version("6.0"),
    :tags($["love"]),
    :unicode_version(""),
  ).Map,
  'the raw emoji data looks ok';

# vim: expandtab shiftwidth=4


