@cryptotaxi247 / kubo / commits / c21421035

add some basic testing for object patch

Jeromy committed Jun 6, 2015 at 17:31 UTC c214210354300538b5ae408003b16eea880cbe03
1 file changed +23
test/sharness/t0051-object.sh
+23
@@ -94,6 +94,29 @@ test_object_cmd() {
94 test_cmp expected_putBroken actual_putBroken &&
95 test_cmp expected_putBrokenErr actual_putBrokenErr
96 '
97 +
98 + test_expect_success "'ipfs object patch' should work" '
99 + EMPTY_DIR=$(ipfs object new unixfs-dir) &&
100 + OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)
101 + '
102 +
103 + test_expect_success "should have created dir within a dir" '
104 + ipfs ls $OUTPUT > patched_output
105 + '
106 +
107 + test_expect_success "output looks good" '
108 + echo "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4 foo/ " > patched_exp &&
109 + test_cmp patched_exp patched_output
110 + '
111 +
112 + test_expect_success "can remove the directory" '
113 + ipfs object patch $OUTPUT rm-link foo > rmlink_output
114 + '
115 +
116 + test_expect_success "output should be empty" '
117 + echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > rmlink_exp &&
118 + test_cmp rmlink_exp rmlink_output
119 + '
120 }
121
122 # should work offline