You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -208,6 +207,57 @@ describe("File upload", function () {
208
207
sinon.assert.calledWith(callback,{message: "Invalid response from authenticationEndpoint. The SDK expects a JSON response with three fields i.e. signature, token and expire.",help: ""},null);
209
208
});
210
209
210
+
it('Auth endpoint 200 status with bad body',asyncfunction(){
211
+
constfileOptions={
212
+
fileName: "test_file_name",
213
+
file: "test_file"
214
+
};
215
+
216
+
varcallback=sinon.spy();
217
+
218
+
imagekit.upload(fileOptions,callback);
219
+
220
+
expect(server.requests.length).to.be.equal(2);
221
+
222
+
// Simulate non 200 response on authentication endpoint
sinon.assert.calledWith(callback,{message: "Invalid response from authenticationEndpoint. The SDK expects a JSON response with three fields i.e. signature, token and expire.",help: ""},null);
232
+
});
233
+
234
+
it('Auth endpoint 200 status missing token',asyncfunction(){
235
+
constfileOptions={
236
+
fileName: "test_file_name",
237
+
file: "test_file"
238
+
};
239
+
240
+
varcallback=sinon.spy();
241
+
242
+
imagekit.upload(fileOptions,callback);
243
+
244
+
expect(server.requests.length).to.be.equal(2);
245
+
246
+
// Simulate non 200 response on authentication endpoint
sinon.assert.calledWith(callback,{message: "Invalid response from authenticationEndpoint. The SDK expects a JSON response with three fields i.e. signature, token and expire.",help: ""},null);
0 commit comments