@@ -11,82 +11,71 @@ describe('block', () => runOnAndOff((thing) => {
1111 ipfs = thing . ipfs
1212 } )
1313
14- it ( 'put' , function ( ) {
14+ it ( 'put' , async function ( ) {
1515 this . timeout ( 40 * 1000 )
16- return ipfs ( 'block put test/fixtures/test-data/hello' ) . then ( ( out ) => {
17- expect ( out ) . to . eql ( 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n ')
18- } )
16+
17+ const out = await ipfs ( 'block put test/fixtures/test-data/hello ')
18+ expect ( out ) . to . eql ( 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n' )
1919 } )
2020
21- it ( 'put with flags, format and mhtype' , function ( ) {
21+ it ( 'put with flags, format and mhtype' , async function ( ) {
2222 this . timeout ( 40 * 1000 )
2323
24- return ipfs ( 'block put --format eth-block --mhtype keccak-256 test/fixtures/test-data/eth-block' )
25- . then ( ( out ) =>
26- expect ( out ) . to . eql ( 'bagiacgzarkhijr4xmbp345ovwwxra7kcecrnwcwtl7lg3g7d2ogyprdswjwq\n' ) )
24+ const out = await ipfs ( 'block put --format eth-block --mhtype keccak-256 test/fixtures/test-data/eth-block' )
25+ expect ( out ) . to . eql ( 'bagiacgzarkhijr4xmbp345ovwwxra7kcecrnwcwtl7lg3g7d2ogyprdswjwq\n' )
2726 } )
2827
29- it ( 'should put and print CID encoded in specified base' , function ( ) {
28+ it ( 'should put and print CID encoded in specified base' , async function ( ) {
3029 this . timeout ( 40 * 1000 )
3130
32- return ipfs ( 'block put test/fixtures/test-data/hello --cid-base=base64' ) . then ( ( out ) => {
33- expect ( out ) . to . eql ( 'mAXASIKlIkE8vD0ebj4GXaUswGEsNLtHBzSoewPuF0pmhkqRH\n' )
34- } )
31+ const out = await ipfs ( 'block put test/fixtures/test-data/hello --cid-base=base64' )
32+ expect ( out ) . to . eql ( 'mAXASIKlIkE8vD0ebj4GXaUswGEsNLtHBzSoewPuF0pmhkqRH\n' )
3533 } )
3634
37- it ( 'get' , function ( ) {
35+ it ( 'get' , async function ( ) {
3836 this . timeout ( 40 * 1000 )
3937
40- return ipfs ( 'block get QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
41- . then ( ( out ) => expect ( out ) . to . eql ( 'hello world\n' ) )
38+ const out = await ipfs ( 'block get QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
39+ expect ( out ) . to . eql ( 'hello world\n' )
4240 } )
4341
44- it ( 'get block from file without a final newline' , function ( ) {
42+ it ( 'get block from file without a final newline' , async function ( ) {
4543 this . timeout ( 40 * 1000 )
4644
47- return ipfs ( 'block put test/fixtures/test-data/no-newline' ) . then ( ( out ) => {
48- expect ( out ) . to . eql ( 'QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL\n' )
49- return ipfs ( 'block get QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL' )
50- } )
51- . then ( ( out ) => expect ( out ) . to . eql ( 'there is no newline at end of this file' ) )
45+ const out = await ipfs ( 'block put test/fixtures/test-data/no-newline' )
46+ expect ( out ) . to . eql ( 'QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL\n' )
47+
48+ const out2 = await ipfs ( 'block get QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL' )
49+ expect ( out2 ) . to . eql ( 'there is no newline at end of this file' )
5250 } )
5351
54- it ( 'stat' , function ( ) {
52+ it ( 'stat' , async function ( ) {
5553 this . timeout ( 40 * 1000 )
5654
57- return ipfs ( 'block stat QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
58- . then ( ( out ) => {
59- expect ( out ) . to . eql ( [
60- 'Key: QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' ,
61- 'Size: 12'
62- ] . join ( '\n' ) + '\n' )
63- } )
55+ const out = await ipfs ( 'block stat QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
56+ expect ( out ) . to . eql ( [
57+ 'Key: QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' ,
58+ 'Size: 12'
59+ ] . join ( '\n' ) + '\n' )
6460 } )
6561
66- it ( 'should stat and print CID encoded in specified base' , function ( ) {
62+ it ( 'should stat and print CID encoded in specified base' , async function ( ) {
6763 this . timeout ( 80 * 1000 )
6864
69- return ipfs ( 'block put test/fixtures/test-data/hello' )
70- . then ( ( out ) => {
71- expect ( out ) . to . eql ( 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n' )
72- return ipfs ( 'block stat QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp --cid-base=base64' )
73- } )
74- . then ( ( out ) => {
75- expect ( out ) . to . eql ( [
76- 'Key: mAXASIKlIkE8vD0ebj4GXaUswGEsNLtHBzSoewPuF0pmhkqRH' ,
77- 'Size: 12'
78- ] . join ( '\n' ) + '\n' )
79- } )
65+ const out = await ipfs ( 'block put test/fixtures/test-data/hello' )
66+ expect ( out ) . to . eql ( 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n' )
67+
68+ const out2 = await ipfs ( 'block stat QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp --cid-base=base64' )
69+ expect ( out2 ) . to . eql ( [
70+ 'Key: mAXASIKlIkE8vD0ebj4GXaUswGEsNLtHBzSoewPuF0pmhkqRH' ,
71+ 'Size: 12'
72+ ] . join ( '\n' ) + '\n' )
8073 } )
8174
82- it . skip ( 'rm' , function ( ) {
75+ it . skip ( 'rm' , async function ( ) {
8376 this . timeout ( 40 * 1000 )
8477
85- return ipfs ( 'block rm QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
86- . then ( ( out ) => {
87- expect ( out ) . to . eql (
88- 'removed QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n'
89- )
90- } )
78+ const out = await ipfs ( 'block rm QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp' )
79+ expect ( out ) . to . eql ( 'removed QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n' )
9180 } )
9281} ) )
0 commit comments