from aave_compress.rules import (
    MARKERS,
    completive_done,
    continuative_steady,
    habitual_be,
    prospective_finna,
    zero_copula,
)


def test_markers_registry():
    assert set(MARKERS) == {
        "zero_copula",
        "habitual_be",
        "completive_done",
        "prospective_finna",
        "continuative_steady",
    }
    assert MARKERS["zero_copula"] is zero_copula


def test_zero_copula_adjective_predicate():
    assert zero_copula("He is tired") == "He tired"


def test_zero_copula_verbing_predicate():
    assert zero_copula("She is working") == "She working"


def test_zero_copula_adjective_after_article_subject():
    assert zero_copula("The server is down") == "The server down"


def test_zero_copula_locative_predicate():
    assert zero_copula("They are here") == "They here"


def test_zero_copula_gonna():
    assert zero_copula("He is gonna crash") == "He gonna crash"


def test_zero_copula_sentence_final_unchanged():
    assert zero_copula("I don't know where he is") == "I don't know where he is"


def test_zero_copula_noun_phrase_predicate_unchanged():
    assert zero_copula("He is a doctor") == "He is a doctor"


def test_zero_copula_question_inversion_unchanged():
    assert zero_copula("Is he tired?") == "Is he tired?"


def test_zero_copula_equative_gerund_unchanged():
    assert zero_copula("The goal is finding bugs") == "The goal is finding bugs"


def test_habitual_be_third_person():
    assert (
        habitual_be("This endpoint usually times out when traffic is high")
        == "This endpoint be timin out when traffic is high"
    )


def test_habitual_be_typically():
    assert habitual_be("She typically works late") == "She be workin late"


def test_habitual_be_often():
    assert (
        habitual_be("The build often fails on Mondays")
        == "The build be failin on Mondays"
    )


def test_habitual_be_no_adverb_unchanged():
    assert habitual_be("He is working right now") == "He is working right now"


def test_habitual_be_copula_before_adverb_unchanged():
    assert habitual_be("He is usually tired") == "He is usually tired"


def test_completive_done_finished_gerund():
    assert (
        completive_done("I have already finished testing the auth flow")
        == "I done tested the auth flow"
    )


def test_completive_done_irregular_ambiguous():
    assert completive_done("She has already left") == "She done left"


def test_completive_done_regular_participle():
    assert (
        completive_done("They had already deployed the fix")
        == "They done deployed the fix"
    )


def test_completive_done_simple_past_unchanged():
    assert completive_done("I finished testing") == "I finished testing"


def test_completive_done_been_unchanged():
    assert (
        completive_done("You have already been notified")
        == "You have already been notified"
    )


def test_prospective_finna_first_person():
    assert (
        prospective_finna("I am about to deploy this to production")
        == "I'm finna deploy this to production"
    )


def test_prospective_finna_third_person():
    assert prospective_finna("He is about to leave") == "He finna leave"


def test_prospective_finna_getting_ready_to():
    assert (
        prospective_finna("They are getting ready to migrate the database")
        == "They finna migrate the database"
    )


def test_prospective_finna_going_to_verb():
    assert (
        prospective_finna("We are going to refactor this module")
        == "We finna refactor this module"
    )


def test_prospective_finna_plain_present_unchanged():
    assert prospective_finna("I deploy code every day") == "I deploy code every day"


def test_prospective_finna_going_to_noun_unchanged():
    assert (
        prospective_finna("She is going to the store")
        == "She is going to the store"
    )


def test_continuative_steady_combined_adverbs():
    assert (
        continuative_steady(
            "The API is constantly and persistently timing out under load"
        )
        == "The API steady timin out under load"
    )


def test_continuative_steady_single_adverb():
    assert (
        continuative_steady("He is constantly complaining about the linter")
        == "He steady complainin about the linter"
    )


def test_continuative_steady_plural():
    assert (
        continuative_steady("They are continuously refreshing the page")
        == "They steady refreshin the page"
    )


def test_continuative_steady_no_adverb_unchanged():
    assert continuative_steady("The API is timing out") == "The API is timing out"
