Skip to content

Commit 3dc26c9

Browse files
committed
tests for 'object put' with file and from stdin
1 parent 707eebe commit 3dc26c9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/sharness/t0051-object.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,35 @@ echo "CumulativeSize: 18" >> expected_stat &&
4646
test_cmp expected_stat actual_stat
4747
'
4848

49+
# semicool way to get json inline without much escaping
50+
objectPutJson=$(cat << EOF
51+
{
52+
"Data": "test json for sharness test"
53+
}
54+
EOF
55+
)
56+
57+
test_expect_success "'ipfs object put file.json' succeeds" '
58+
echo $objectPutJson > file.json &&
59+
ipfs object put file.json > actual_putOut
60+
'
61+
62+
test_expect_success "'ipfs object put file.json' output looks good" '
63+
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
64+
echo -n "added $HASH" > expected_putOut &&
65+
test_cmp expected_putOut actual_putOut
66+
'
67+
68+
test_expect_success "'ipfs object put' from stdin succeeds" '
69+
echo $objectPutJson | ipfs object put > actual_putStdinOut
70+
'
71+
72+
test_expect_success "'ipfs object put' from stdin output looks good" '
73+
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
74+
echo -n "added $HASH" > expected_putStdinOut &&
75+
test_cmp expected_putStdinOut actual_putStdinOut
76+
'
77+
78+
79+
4980
test_done

0 commit comments

Comments
 (0)