@@ -8,47 +8,41 @@ describe('.object', () => {
8
8
9
9
it ( 'object.put' , done => {
10
10
apiClients [ 'a' ] . object . put ( testObject , 'json' , ( err , res ) => {
11
- if ( err ) throw err
12
- const obj = res
13
- assert . equal ( obj . Hash , testObjectHash )
14
- assert . equal ( obj . Links . length , 0 )
11
+ expect ( err ) . to . not . exist
12
+ expect ( res ) . to . have . a . property ( 'Hash' , testObjectHash )
13
+ expect ( res . Links ) . to . be . empty
15
14
done ( )
16
15
} )
17
16
} )
18
17
19
18
it ( 'object.get' , done => {
20
19
apiClients [ 'a' ] . object . get ( testObjectHash , ( err , res ) => {
21
- if ( err ) {
22
- throw err
23
- }
24
- const obj = res
25
- assert . equal ( obj . Data , 'testdata' )
26
- assert . equal ( obj . Links . length , 0 )
20
+ expect ( err ) . to . not . exist
21
+ expect ( res ) . to . have . a . property ( 'Data' , 'testdata' )
22
+ expect ( res . Links ) . to . be . empty
27
23
done ( )
28
24
} )
29
25
} )
30
26
31
27
it ( 'object.data' , done => {
32
28
apiClients [ 'a' ] . object . data ( testObjectHash , ( err , res ) => {
33
- if ( err ) throw err
29
+ expect ( err ) . to . not . exist
34
30
35
31
let buf = ''
36
32
res
37
33
. on ( 'error' , err => { throw err } )
38
34
. on ( 'data' , data => buf += data )
39
35
. on ( 'end' , ( ) => {
40
- assert . equal ( buf , 'testdata' )
36
+ expect ( buf ) . to . equal ( 'testdata' )
41
37
done ( )
42
38
} )
43
39
} )
44
40
} )
45
41
46
42
it ( 'object.stat' , done => {
47
43
apiClients [ 'a' ] . object . stat ( testObjectHash , ( err , res ) => {
48
- if ( err ) {
49
- throw err
50
- }
51
- assert . deepEqual ( res , {
44
+ expect ( err ) . to . not . exist
45
+ expect ( res ) . to . be . eql ( {
52
46
Hash : 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' ,
53
47
NumLinks : 0 ,
54
48
BlockSize : 10 ,
@@ -62,11 +56,9 @@ describe('.object', () => {
62
56
63
57
it ( 'object.links' , done => {
64
58
apiClients [ 'a' ] . object . links ( testObjectHash , ( err , res ) => {
65
- if ( err ) {
66
- throw err
67
- }
59
+ expect ( err ) . to . not . exist
68
60
69
- assert . deepEqual ( res , {
61
+ expect ( res ) . to . be . eql ( {
70
62
Hash : 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' ,
71
63
Links : [ ]
72
64
} )
@@ -76,23 +68,16 @@ describe('.object', () => {
76
68
77
69
it ( 'object.patch' , done => {
78
70
apiClients [ 'a' ] . object . put ( testPatchObject , 'json' , ( err , res ) => {
79
- if ( err ) {
80
- throw err
81
- }
71
+ expect ( err ) . to . not . exist
82
72
apiClients [ 'a' ] . object . patch ( testObjectHash , [ 'add-link' , 'next' , testPatchObjectHash ] , ( err , res ) => {
83
- if ( err ) {
84
- throw err
85
- }
86
-
87
- assert . deepEqual ( res , {
73
+ expect ( err ) . to . not . exist
74
+ expect ( res ) . to . be . eql ( {
88
75
Hash : 'QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd' ,
89
76
Links : null
90
77
} )
91
78
apiClients [ 'a' ] . object . get ( res . Hash , ( err , res2 ) => {
92
- if ( err ) {
93
- throw err
94
- }
95
- assert . deepEqual ( res2 , {
79
+ expect ( err ) . to . not . exist
80
+ expect ( res2 ) . to . be . eql ( {
96
81
Data : 'testdata' ,
97
82
Links : [ {
98
83
Name : 'next' ,
0 commit comments