mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-27 23:52:41 +01:00
#682: Unify work with output in classic and instant mode
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import pytest
|
||||
from thefuck.rules.npm_wrong_command import match, get_new_command
|
||||
from tests.utils import Command
|
||||
from thefuck.types import Command
|
||||
|
||||
stdout = '''
|
||||
output = '''
|
||||
Usage: npm <command>
|
||||
|
||||
where <command> is one of:
|
||||
@@ -38,16 +38,16 @@ npm@2.14.7 /opt/node/lib/node_modules/npm
|
||||
'npm -f urgrade -g',
|
||||
'npm urg'])
|
||||
def test_match(script):
|
||||
assert match(Command(script, stdout))
|
||||
assert match(Command(script, output))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, stdout', [
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
('npm urgrade', ''),
|
||||
('npm', stdout),
|
||||
('test urgrade', stdout),
|
||||
('npm -e', stdout)])
|
||||
def test_not_match(script, stdout):
|
||||
assert not match(Command(script, stdout))
|
||||
('npm', output),
|
||||
('test urgrade', output),
|
||||
('npm -e', output)])
|
||||
def test_not_match(script, output):
|
||||
assert not match(Command(script, output))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, result', [
|
||||
@@ -55,4 +55,4 @@ def test_not_match(script, stdout):
|
||||
('npm -g isntall gulp', 'npm -g install gulp'),
|
||||
('npm isntall -g gulp', 'npm install -g gulp')])
|
||||
def test_get_new_command(script, result):
|
||||
assert get_new_command(Command(script, stdout)) == result
|
||||
assert get_new_command(Command(script, output)) == result
|
||||
|
Reference in New Issue
Block a user