github.com/whyrusleeping/gx@v0.14.3/tests/t0020-view.sh (about) 1 #!/bin/sh 2 # 3 # Copyright (c) 2015 Jeromy Johnson 4 # MIT Licensed; see the LICENSE file in this repository. 5 # 6 7 test_description="test gx view" 8 9 . lib/test-lib.sh 10 11 test_init_ipfs 12 test_launch_ipfs_daemon 13 14 test_expect_success "setup test package" ' 15 mkdir mypkg && 16 cd mypkg && 17 gx init --lang=none 18 ' 19 20 test_expect_success "gx view . succeeds" ' 21 gx view . > gx_out && 22 jq -S . gx_out > full_out 23 ' 24 25 test_expect_success "output looks good" ' 26 jq -S . package.json > sorted_pkg && 27 test_cmp sorted_pkg full_out 28 ' 29 30 test_expect_success "gx view individual field works" ' 31 gx view .language > lang_out 32 ' 33 34 test_expect_success "gx view individual field works" ' 35 echo "none" > lang_exp && 36 test_cmp lang_exp lang_out 37 ' 38 39 test_expect_success "gx set language field works" ' 40 gx set .language testLang 41 ' 42 43 test_expect_success "gx view language field still works" ' 44 echo testLang >expected && 45 gx view .language >actual && 46 test_cmp expected actual 47 ' 48 49 test_expect_success "gx set license field works" ' 50 gx set .license MIT 51 ' 52 53 test_expect_success "gx view license field works" ' 54 echo MIT >expected && 55 gx view .license >actual && 56 test_cmp expected actual 57 ' 58 59 test_kill_ipfs_daemon 60 61 test_done