Skip to content

Commit

Permalink
test: add dag get --ouput-codec test
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Sep 27, 2021
1 parent 56a2ae9 commit 49058c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/sharness/t0053-dag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ test_dag_cmd() {
ipfs dag get $IPLDPBHASH >& dag-get-pb
'

test_expect_success "can get dag-pb block transcoded as dag-cbor" '
ipfs dag get --output-codec=dag-cbor $IPLDPBHASH >& dag-get-dagpb-transcoded-to-dagcbor &&
echo "82a2e4c892e7dcf1d491b30d68aa73ba76bec94f87d4e1a887596ce0730a534a" >sha2_dagpb_to_dagcbor_expected &&
multihash -a=sha2-256 -e=hex dag-get-dagpb-transcoded-to-dagcbor >sha2_dagpb_to_dagcbor_actual &&
test_cmp sha2_dagpb_to_dagcbor_expected sha2_dagpb_to_dagcbor_actual
'

test_expect_success "dag put and dag get transcodings match" '
ROUNDTRIPDAGCBOR=$(ipfs dag put --input-codec=dag-cbor --store-codec=dag-cbor dag-get-dagpb-transcoded-to-dagcbor) &&
test $ROUNDTRIPDAGCBOR = $IPLDCBORHASH
'

# this doesn't tell us if they are correct, we test that better below
test_expect_success "outputs are the same" '
test_cmp dag-get-cbor dag-get-json &&
Expand Down

0 comments on commit 49058c2

Please sign in to comment.