diff --git a/test/sharness/t0100-name.sh b/test/sharness/t0100-name.sh index 7dbaa7f7988b..163320f0752d 100755 --- a/test/sharness/t0100-name.sh +++ b/test/sharness/t0100-name.sh @@ -114,5 +114,26 @@ test_expect_success "empty request to name publish doesn't panic and returns err test_kill_ipfs_daemon +# Test daemon in offline mode +test_launch_ipfs_daemon --offline + +test_expect_success "'ipfs name publish' fails offline mode" ' + PEERID=`ipfs id --format=""` && + test_check_peerid "${PEERID}" && + test_expect_code 1 ipfs name publish "/ipfs/$HASH_WELCOME_DOCS/help" +' + +test_expect_success "'ipfs name publish --allow-offline ' succeed offline mode" ' + PEERID=`ipfs id --format=""` && + test_check_peerid "${PEERID}" && + ipfs name publish --allow-offline "/ipfs/$HASH_WELCOME_DOCS/help" >publish_out +' + +test_expect_success "publish a path looks good" ' + echo "Published to ${PEERID}: /ipfs/$HASH_WELCOME_DOCS/help" >expected3 && + test_cmp expected3 publish_out +' + +test_kill_ipfs_daemon test_done