Skip to content

Commit 6c75e93

Browse files
committed
Fix unit tests after earlier update
The `s3.upload` was using a promise version internally now, so the tests needed to be updated to match that API.
1 parent b538c98 commit 6c75e93

File tree

2 files changed

+48
-20
lines changed

2 files changed

+48
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "s3-batch-upload",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Super fast batched S3 folder uploads from CLI or API.",
55
"main": "./index.js",
66
"types": "./index.d.ts",

test/Uploader.spec.ts

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ describe('Uploader', () => {
1515
this.timeout(10000);
1616

1717
const s3 = {
18-
upload(_, cb) {
19-
cb(null);
18+
upload() {
19+
return {
20+
async promise() {
21+
return null;
22+
}
23+
}
2024
}
2125
};
2226
spy(s3, "upload");
@@ -50,8 +54,12 @@ describe('Uploader', () => {
5054
this.timeout(10000);
5155

5256
const s3 = {
53-
upload(_, cb) {
54-
cb(null);
57+
upload() {
58+
return {
59+
async promise() {
60+
return null;
61+
}
62+
}
5563
}
5664
};
5765
spy(s3, "upload");
@@ -87,8 +95,12 @@ describe('Uploader', () => {
8795
this.timeout(5000);
8896

8997
const s3 = {
90-
upload(_, cb) {
91-
cb(null);
98+
upload() {
99+
return {
100+
async promise() {
101+
return null;
102+
}
103+
}
92104
}
93105
};
94106
spy(s3, "upload");
@@ -123,13 +135,17 @@ describe('Uploader', () => {
123135
this.timeout(10000);
124136

125137
const s3 = {
126-
upload(_, cb) {
127-
cb(null);
138+
upload() {
139+
return {
140+
async promise() {
141+
return null;
142+
}
143+
}
128144
},
129-
headObject(_) {
145+
headObject() {
130146
return {
131-
promise() {
132-
return Promise.resolve(null)
147+
async promise() {
148+
return null;
133149
}
134150
}
135151
}
@@ -161,15 +177,19 @@ describe('Uploader', () => {
161177
this.timeout(10000);
162178

163179
const s3 = {
164-
upload(_, cb) {
165-
cb(null);
180+
upload() {
181+
return {
182+
async promise() {
183+
return null;
184+
}
185+
}
166186
},
167187
headObject(_) {
168188
return {
169-
promise() {
189+
async promise() {
170190
const err: any = new Error()
171191
err.code = 'NotFound'
172-
return Promise.reject(err)
192+
throw err;
173193
}
174194
}
175195
}
@@ -248,8 +268,12 @@ describe('Uploader', () => {
248268
this.timeout(5000);
249269

250270
const s3 = {
251-
upload(_, cb) {
252-
cb(null);
271+
upload() {
272+
return {
273+
async promise() {
274+
return null;
275+
}
276+
}
253277
}
254278
};
255279
spy(s3, "upload");
@@ -275,8 +299,12 @@ describe('Uploader', () => {
275299
this.timeout(10000);
276300

277301
const s3 = {
278-
upload(_, cb) {
279-
cb(null);
302+
upload() {
303+
return {
304+
async promise() {
305+
return null;
306+
}
307+
}
280308
}
281309
};
282310
spy(s3, "upload");

0 commit comments

Comments
 (0)