# retoor <retoor@molodetz.nl>

from devplacepy.constants import REACTION_EMOJI
from devplacepy.templating import reaction_emojis

UNICORN = "\U0001F984"
ROBOT = "\U0001F916"


def test_no_reactions_renders_the_quick_pick_palette():
    assert reaction_emojis(None) == REACTION_EMOJI
    assert reaction_emojis({}) == REACTION_EMOJI
    assert reaction_emojis({"counts": {}, "mine": []}) == REACTION_EMOJI


def test_palette_emoji_are_not_duplicated():
    palette_emoji = REACTION_EMOJI[0]
    assert reaction_emojis({"counts": {palette_emoji: 3}, "mine": [palette_emoji]}) == REACTION_EMOJI


def test_off_palette_emoji_are_appended_after_the_palette():
    assert reaction_emojis({"counts": {UNICORN: 2}, "mine": []}) == REACTION_EMOJI + [UNICORN]


def test_own_off_palette_reaction_is_included_without_a_count():
    assert reaction_emojis({"counts": {}, "mine": [ROBOT]}) == REACTION_EMOJI + [ROBOT]


def test_counted_and_own_off_palette_emoji_appear_once_each():
    emojis = reaction_emojis({"counts": {UNICORN: 1, ROBOT: 4}, "mine": [ROBOT]})

    assert emojis == REACTION_EMOJI + [UNICORN, ROBOT]
    assert len(emojis) == len(set(emojis))
