diff --git a/package.json b/package.json index f24ac8b..5a53cea 100755 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/Uploader.spec.ts b/test/Uploader.spec.ts index 286ac82..ef0cb1d 100644 --- a/test/Uploader.spec.ts +++ b/test/Uploader.spec.ts @@ -15,8 +15,12 @@ describe('Uploader', () => { this.timeout(10000); const s3 = { - upload(_, cb) { - cb(null); + upload() { + return { + async promise() { + return null; + } + } } }; spy(s3, "upload"); @@ -50,8 +54,12 @@ describe('Uploader', () => { this.timeout(10000); const s3 = { - upload(_, cb) { - cb(null); + upload() { + return { + async promise() { + return null; + } + } } }; spy(s3, "upload"); @@ -87,8 +95,12 @@ describe('Uploader', () => { this.timeout(5000); const s3 = { - upload(_, cb) { - cb(null); + upload() { + return { + async promise() { + return null; + } + } } }; spy(s3, "upload"); @@ -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; } } } @@ -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; } } } @@ -248,8 +268,12 @@ describe('Uploader', () => { this.timeout(5000); const s3 = { - upload(_, cb) { - cb(null); + upload() { + return { + async promise() { + return null; + } + } } }; spy(s3, "upload"); @@ -275,8 +299,12 @@ describe('Uploader', () => { this.timeout(10000); const s3 = { - upload(_, cb) { - cb(null); + upload() { + return { + async promise() { + return null; + } + } } }; spy(s3, "upload");