Skip to content

Commit

Permalink
feat: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Jan 25, 2023
1 parent 38bdf21 commit a38adc6
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions test/sharness/t0100-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,30 @@ test_name_with_self() {
grep "argument \"ipfs-path\" is required" curl_out
'

# test publishing with TTL
# Test Publishing with TTL and Inspecting Records
test_expect_success "'ipfs name publish --ttl=30m' succeeds" '
ipfs name publish --ttl=30m --allow-offline "/ipfs/$HASH_WELCOME_DOCS" &&
ipfs routing get "/ipns/$PEERID" > ipns_record &&
ipfs name inspect --verify $PEERID < ipns_record > verify_output &&
ipfs name publish --ttl=30m --allow-offline "/ipfs/$HASH_WELCOME_DOCS"
'

test_expect_success "retrieve IPNS key for further inspection" '
ipfs routing get "/ipns/$PEERID" > ipns_record
'

test_expect_success "'ipfs name inspect' has correct TTL (30m)" '
ipfs name inspect < ipns_record > verify_output &&
test_should_contain "This record was not validated." verify_output &&
test_should_contain "$HASH_WELCOME_DOCS" verify_output &&
test_should_contain "1800000000000" verify_output
'

test_expect_success "'ipfs name inspect --verify' has '.Validation.Validity' set to 'true' with correct Peer ID" '
ipfs name inspect --verify $PEERID --enc json < ipns_record | jq -e ".Validation.Valid == true"
'

test_expect_success "'ipfs name inspect --verify' has '.Validation.Validity' set to 'false' with incorrect Peer ID" '
ipfs name inspect --verify 12D3KooWRirYjmmQATx2kgHBfky6DADsLP7ex1t7BRxJ6nqLs9WH --enc json < ipns_record | jq -e ".Validation.Valid == false"
'

test_kill_ipfs_daemon

# Test daemon in offline mode
Expand Down

0 comments on commit a38adc6

Please sign in to comment.