from src.gameplay.core.tasks.castSpell import CastSpellTask


def test_should_cast_via_chat_words(mocker):
    context = {'ng_screenshot': []}
    pressSpy = mocker.patch('src.utils.keyboard.press')
    writeSpy = mocker.patch('src.utils.keyboard.write')

    task = CastSpellTask('exura vita')

    assert task.name == 'castSpell'
    assert task.do(context) == context
    assert pressSpy.call_args_list == [mocker.call('enter'), mocker.call('enter')]
    writeSpy.assert_called_once_with('exura vita')
