2017-02-26 20:26:15 -05:00
|
|
|
import pytest
|
|
|
|
from thefuck.rules.yarn_alias import match, get_new_command
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2017-02-26 20:26:15 -05:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
output_remove = 'error Did you mean `yarn remove`?'
|
|
|
|
output_etl = 'error Command "etil" not found. Did you mean "etl"?'
|
|
|
|
output_list = 'error Did you mean `yarn list`?'
|
2017-02-26 20:26:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
Command('yarn rm', output_remove),
|
|
|
|
Command('yarn etil', output_etl),
|
|
|
|
Command('yarn ls', output_list)])
|
2017-02-26 20:26:15 -05:00
|
|
|
def test_match(command):
|
|
|
|
assert match(command)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command, new_command', [
|
2017-08-31 17:58:56 +02:00
|
|
|
(Command('yarn rm', output_remove), 'yarn remove'),
|
|
|
|
(Command('yarn etil', output_etl), 'yarn etl'),
|
|
|
|
(Command('yarn ls', output_list), 'yarn list')])
|
2017-02-26 20:26:15 -05:00
|
|
|
def test_get_new_command(command, new_command):
|
|
|
|
assert get_new_command(command) == new_command
|