|
@@ -114,3 +114,34 @@ describe('Progress report test', (report, done) => {
|
114
|
114
|
})
|
115
|
115
|
|
116
|
116
|
})
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+describe('PUT request test', (report, done) => {
|
|
120
|
+
|
|
121
|
+ RNFetchBlob.fetch('PUT', `${TEST_SERVER_URL}/upload-form`, {
|
|
122
|
+ Authorization : "Bearer fsXcpmKPrHgAAAAAAAAAEGxFXwhejXM_E8fznZoXPhHbhbNhA-Lytbe6etp1Jznz",
|
|
123
|
+ 'Content-Type' : 'multipart/form-data',
|
|
124
|
+ }, [
|
|
125
|
+ { name : 'test-img', filename : 'test-img.png', data: image},
|
|
126
|
+ { name : 'test-text', filename : 'test-text.txt', data: RNFetchBlob.base64.encode('hello.txt')},
|
|
127
|
+ { name : 'field1', data : 'hello !!'},
|
|
128
|
+ { name : 'field2', data : 'hello2 !!'}
|
|
129
|
+ ])
|
|
130
|
+ .then((resp) => {
|
|
131
|
+ resp = resp.json()
|
|
132
|
+ report(
|
|
133
|
+ <Assert key="check put form data #1" expect="hello !!" actual={resp.fields.field1}/>,
|
|
134
|
+ <Assert key="check put form data #2" expect="hello2 !!" actual={resp.fields.field2}/>,
|
|
135
|
+ )
|
|
136
|
+ done()
|
|
137
|
+ })
|
|
138
|
+})
|
|
139
|
+
|
|
140
|
+describe('DELETE request test', (report, done) => {
|
|
141
|
+ RNFetchBlob.fetch('DELETE', `${TEST_SERVER_URL}/hey`)
|
|
142
|
+ .then((resp) => {
|
|
143
|
+ report(
|
|
144
|
+ <Assert key="check DELETE request result" expect={'man'} actual={resp.text()}/>,
|
|
145
|
+ done()
|
|
146
|
+ })
|
|
147
|
+})
|