|
@@ -110,3 +110,45 @@ describe('#247 binary data UTF8 encoding causes app crash', (report, done) => {
|
110
|
110
|
})
|
111
|
111
|
|
112
|
112
|
})
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+describe('#248 create blob from file has spaces in filename', (report, done) => {
|
|
116
|
+
|
|
117
|
+ let source = '',
|
|
118
|
+ size = 0,
|
|
119
|
+ path = 'archive image.zip'
|
|
120
|
+ RNFetchBlob
|
|
121
|
+ .config({path : fs.dirs.DocumentDir +'/' + path})
|
|
122
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/issue-248-dummy.zip`)
|
|
123
|
+ .then((res) => {
|
|
124
|
+ source = res.path();
|
|
125
|
+ console.log('source=', source)
|
|
126
|
+ window.Blob = RNFetchBlob.polyfill.Blob;
|
|
127
|
+ return Blob.build(RNFetchBlob.wrap(source), { type : 'application/zip'})
|
|
128
|
+ })
|
|
129
|
+ .then((b) => {
|
|
130
|
+ console.log(b)
|
|
131
|
+ size = b.size
|
|
132
|
+ return fs.stat(b._ref)
|
|
133
|
+ })
|
|
134
|
+ .then((stat) => {
|
|
135
|
+ report(<Assert key="blob created without error"
|
|
136
|
+ expect={stat.size} actual={size}/>)
|
|
137
|
+ return RNFetchBlob.fetch('POST',
|
|
138
|
+ `${TEST_SERVER_URL}/upload-form`,
|
|
139
|
+ {
|
|
140
|
+ 'Content-Type' : 'multipart/form-data'
|
|
141
|
+ }, [
|
|
142
|
+ {
|
|
143
|
+ name : 'file',
|
|
144
|
+ filename : 'file name '+Platform.OS+'.zip',
|
|
145
|
+ type : 'application/zip',
|
|
146
|
+ data : RNFetchBlob.wrap(source)
|
|
147
|
+ }
|
|
148
|
+ ])
|
|
149
|
+ })
|
|
150
|
+ .then(() => {
|
|
151
|
+ done()
|
|
152
|
+ })
|
|
153
|
+
|
|
154
|
+})
|