@@ -88,52 +88,52 @@ module.exports = function (repo) {
88
88
} )
89
89
testExport . pipe ( concat ( ( files ) => {
90
90
expect ( files [ 0 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN' )
91
+ expect ( files [ 0 ] . content ) . to . not . exist
92
+
91
93
expect ( files [ 1 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/200Bytes.txt' )
94
+ expect ( files [ 1 ] . content ) . to . exist
95
+
92
96
expect ( files [ 2 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/dir-another' )
97
+ expect ( files [ 2 ] . content ) . to . not . exist
98
+
93
99
expect ( files [ 3 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1' )
100
+ expect ( files [ 3 ] . content ) . to . not . exist
101
+
94
102
expect ( files [ 4 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/200Bytes.txt' )
103
+ expect ( files [ 4 ] . content ) . to . exist
104
+
95
105
expect ( files [ 5 ] . path ) . to . equal ( 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/level-2' )
106
+ expect ( files [ 5 ] . content ) . to . not . exist
107
+
96
108
done ( )
97
109
} ) )
98
110
} )
99
111
100
112
it ( 'returns a null stream for dir' , ( done ) => {
101
- const hash = 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' // This hash doesn't exist in the repo
113
+ const hash = 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'
102
114
const bs = new BlockService ( repo )
103
115
const ds = new DAGService ( bs )
104
116
const testExport = exporter ( hash , ds )
117
+
105
118
testExport . on ( 'error' , ( err ) => {
106
119
expect ( err ) . to . not . exist
107
120
} )
108
- testExport . on ( 'data' , ( dir ) => {
109
- expect ( dir . content ) . to . equal ( null )
121
+
122
+ testExport . on ( 'data' , ( file ) => {
123
+ expect ( file . content ) . to . not . exist
110
124
done ( )
111
125
} )
112
126
} )
113
127
114
128
it ( 'fails on non existent hash' , ( done ) => {
115
- const hash = 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKj3' // This hash doesn't exist in the repo
129
+ // This hash doesn't exist in the repo
130
+ const hash = 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKj3'
116
131
const bs = new BlockService ( repo )
117
132
const ds = new DAGService ( bs )
118
133
const testExport = exporter ( hash , ds )
119
134
testExport . on ( 'error' , ( err ) => {
120
- const error = err . toString ( )
121
135
expect ( err ) . to . exist
122
- const browser = error . includes ( 'Error: key not found:' )
123
- const node = error . includes ( 'no such file or directory' )
124
- // the browser and node js return different errors
125
- if ( browser ) {
126
- expect ( error ) . to . contain ( 'Error: key not found:' )
127
- done ( )
128
- }
129
- if ( node ) {
130
- expect ( error ) . to . contain ( 'no such file or directory' )
131
- done ( )
132
- }
133
- if ( ! node && ! browser ) {
134
- expect ( node ) . to . equal ( true )
135
- done ( )
136
- }
136
+ done ( )
137
137
} )
138
138
} )
139
139
} )
0 commit comments