@@ -11,82 +11,71 @@ describe('block', () => runOnAndOff((thing) => {
11
11
ipfs = thing . ipfs
12
12
} )
13
13
14
- it ( 'put' , function ( ) {
14
+ it ( 'put' , async function ( ) {
15
15
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' )
19
19
} )
20
20
21
- it ( 'put with flags, format and mhtype' , function ( ) {
21
+ it ( 'put with flags, format and mhtype' , async function ( ) {
22
22
this . timeout ( 40 * 1000 )
23
23
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' )
27
26
} )
28
27
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 ( ) {
30
29
this . timeout ( 40 * 1000 )
31
30
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' )
35
33
} )
36
34
37
- it ( 'get' , function ( ) {
35
+ it ( 'get' , async function ( ) {
38
36
this . timeout ( 40 * 1000 )
39
37
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' )
42
40
} )
43
41
44
- it ( 'get block from file without a final newline' , function ( ) {
42
+ it ( 'get block from file without a final newline' , async function ( ) {
45
43
this . timeout ( 40 * 1000 )
46
44
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' )
52
50
} )
53
51
54
- it ( 'stat' , function ( ) {
52
+ it ( 'stat' , async function ( ) {
55
53
this . timeout ( 40 * 1000 )
56
54
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' )
64
60
} )
65
61
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 ( ) {
67
63
this . timeout ( 80 * 1000 )
68
64
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' )
80
73
} )
81
74
82
- it . skip ( 'rm' , function ( ) {
75
+ it . skip ( 'rm' , async function ( ) {
83
76
this . timeout ( 40 * 1000 )
84
77
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' )
91
80
} )
92
81
} ) )
0 commit comments