| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | test_description="Test ipfs cli cmd suggest" |
| 4 | |
| 5 | . lib/test-lib.sh |
| 6 | |
| 7 | test_suggest() { |
| 8 | |
| 9 | |
| 10 | test_expect_success "test command fails" ' |
| 11 | test_must_fail ipfs kog 2>actual |
| 12 | ' |
| 13 | |
| 14 | test_expect_success "test one command is suggested" ' |
| 15 | grep "Did you mean this?" actual && |
| 16 | grep "log" actual || |
| 17 | test_fsh cat actual |
| 18 | ' |
| 19 | |
| 20 | test_expect_success "test command fails" ' |
| 21 | test_must_fail ipfs li 2>actual |
| 22 | ' |
| 23 | |
| 24 | test_expect_success "test multiple commands are suggested" ' |
| 25 | grep "Did you mean any of these?" actual && |
| 26 | grep "ls" actual && |
| 27 | grep "log" actual || |
| 28 | test_fsh cat actual |
| 29 | ' |
| 30 | |
| 31 | } |
| 32 | |
| 33 | test_init_ipfs |
| 34 | |
| 35 | test_suggest |
| 36 | |
| 37 | test_launch_ipfs_daemon |
| 38 | |
| 39 | test_suggest |
| 40 | |
| 41 | test_kill_ipfs_daemon |
| 42 | |
| 43 | test_done |