Skip to content

Commit

Permalink
Fix unit tests after earlier update
Browse files Browse the repository at this point in the history
The `s3.upload` was using a promise version internally now,
so the tests needed to be updated to match that API.
  • Loading branch information
ThaNarie committed Jul 6, 2022
1 parent b538c98 commit 6c75e93
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "s3-batch-upload",
"version": "1.5.1",
"version": "1.5.2",
"description": "Super fast batched S3 folder uploads from CLI or API.",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
66 changes: 47 additions & 19 deletions test/Uploader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ describe('Uploader', () => {
this.timeout(10000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
}
};
spy(s3, "upload");
Expand Down Expand Up @@ -50,8 +54,12 @@ describe('Uploader', () => {
this.timeout(10000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
}
};
spy(s3, "upload");
Expand Down Expand Up @@ -87,8 +95,12 @@ describe('Uploader', () => {
this.timeout(5000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
}
};
spy(s3, "upload");
Expand Down Expand Up @@ -123,13 +135,17 @@ describe('Uploader', () => {
this.timeout(10000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
},
headObject(_) {
headObject() {
return {
promise() {
return Promise.resolve(null)
async promise() {
return null;
}
}
}
Expand Down Expand Up @@ -161,15 +177,19 @@ describe('Uploader', () => {
this.timeout(10000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
},
headObject(_) {
return {
promise() {
async promise() {
const err: any = new Error()
err.code = 'NotFound'
return Promise.reject(err)
throw err;
}
}
}
Expand Down Expand Up @@ -248,8 +268,12 @@ describe('Uploader', () => {
this.timeout(5000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
}
};
spy(s3, "upload");
Expand All @@ -275,8 +299,12 @@ describe('Uploader', () => {
this.timeout(10000);

const s3 = {
upload(_, cb) {
cb(null);
upload() {
return {
async promise() {
return null;
}
}
}
};
spy(s3, "upload");
Expand Down

0 comments on commit 6c75e93

Please sign in to comment.