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
Copy file name to clipboardExpand all lines: test/upload.js
+37-3Lines changed: 37 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -119,19 +119,53 @@ describe("File upload", function () {
119
119
expect(callback.calledOnce).to.be.true;
120
120
sinon.assert.calledWith(callback,{help: "",message: "Missing file parameter for upload"},null);
121
121
});
122
+
123
+
it('Missing token',function(){
124
+
constfileOptions={
125
+
fileName: "test_file_name",
126
+
file: "test_file",
127
+
signature: 'test_signature',
128
+
expire: 123
129
+
};
122
130
123
-
it('Missing security parameters',function(){
131
+
varcallback=sinon.spy();
132
+
133
+
imagekit.upload(fileOptions,callback);
134
+
expect(server.requests.length).to.be.equal(1);
135
+
expect(callback.calledOnce).to.be.true;
136
+
sinon.assert.calledWith(callback,{message: "Missing token for upload. The SDK expects token for authentication.",help: ""},null);
137
+
});
138
+
139
+
it('Missing signature',function(){
124
140
constfileOptions={
125
141
fileName: "test_file_name",
126
-
file: "test_file"
142
+
file: "test_file",
143
+
token: 'test_token',
144
+
expire: 123
145
+
};
146
+
147
+
varcallback=sinon.spy();
148
+
149
+
imagekit.upload(fileOptions,callback);
150
+
expect(server.requests.length).to.be.equal(1);
151
+
expect(callback.calledOnce).to.be.true;
152
+
sinon.assert.calledWith(callback,{message: "Missing signature for upload. The SDK expects signature for authentication.",help: ""},null);
153
+
});
154
+
155
+
it('Missing expire',function(){
156
+
constfileOptions={
157
+
fileName: "test_file_name",
158
+
file: "test_file",
159
+
token: 'test_token',
160
+
signature: 'test_signature'
127
161
};
128
162
129
163
varcallback=sinon.spy();
130
164
131
165
imagekit.upload(fileOptions,callback);
132
166
expect(server.requests.length).to.be.equal(1);
133
167
expect(callback.calledOnce).to.be.true;
134
-
sinon.assert.calledWith(callback,{message: "Missing security parameters for upload. The SDK expects token, signature and expire for authentication.",help: ""},null);
168
+
sinon.assert.calledWith(callback,{message: "Missing expire for upload. The SDK expects expire for authentication.",help: ""},null);
0 commit comments