Skip to content

Commit a38adc6

Browse files
committedJan 25, 2023
feat: add more tests
1 parent 38bdf21 commit a38adc6

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed
 

‎test/sharness/t0100-name.sh

+19-4
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,30 @@ test_name_with_self() {
225225
grep "argument \"ipfs-path\" is required" curl_out
226226
'
227227

228-
# test publishing with TTL
228+
# Test Publishing with TTL and Inspecting Records
229229
test_expect_success "'ipfs name publish --ttl=30m' succeeds" '
230-
ipfs name publish --ttl=30m --allow-offline "/ipfs/$HASH_WELCOME_DOCS" &&
231-
ipfs routing get "/ipns/$PEERID" > ipns_record &&
232-
ipfs name inspect --verify $PEERID < ipns_record > verify_output &&
230+
ipfs name publish --ttl=30m --allow-offline "/ipfs/$HASH_WELCOME_DOCS"
231+
'
232+
233+
test_expect_success "retrieve IPNS key for further inspection" '
234+
ipfs routing get "/ipns/$PEERID" > ipns_record
235+
'
236+
237+
test_expect_success "'ipfs name inspect' has correct TTL (30m)" '
238+
ipfs name inspect < ipns_record > verify_output &&
239+
test_should_contain "This record was not validated." verify_output &&
233240
test_should_contain "$HASH_WELCOME_DOCS" verify_output &&
234241
test_should_contain "1800000000000" verify_output
235242
'
236243

244+
test_expect_success "'ipfs name inspect --verify' has '.Validation.Validity' set to 'true' with correct Peer ID" '
245+
ipfs name inspect --verify $PEERID --enc json < ipns_record | jq -e ".Validation.Valid == true"
246+
'
247+
248+
test_expect_success "'ipfs name inspect --verify' has '.Validation.Validity' set to 'false' with incorrect Peer ID" '
249+
ipfs name inspect --verify 12D3KooWRirYjmmQATx2kgHBfky6DADsLP7ex1t7BRxJ6nqLs9WH --enc json < ipns_record | jq -e ".Validation.Valid == false"
250+
'
251+
237252
test_kill_ipfs_daemon
238253

239254
# Test daemon in offline mode

0 commit comments

Comments
 (0)