diff --git a/lib/wtsqs.js b/lib/wtsqs.js index 7c10a3e..be0a662 100644 --- a/lib/wtsqs.js +++ b/lib/wtsqs.js @@ -142,6 +142,7 @@ class WTSQS { */ async enqueueMany (payloads, { messageGroupId } = {}, sqsOptions = {}) { if (!(payloads instanceof Array)) throw new InvalidArgument('payloads must be of type array') + if (payloads.length === 0) return if (payloads.length > 10) { const chunks = chunk(payloads, 10) diff --git a/test/wtsqs.test.js b/test/wtsqs.test.js index 2ec9477..708e32c 100644 --- a/test/wtsqs.test.js +++ b/test/wtsqs.test.js @@ -52,6 +52,10 @@ describe('WTSQS', () => { } }) + it('should accept empty list of messages', async () => { + await wtsqs.enqueueMany([]) + }) + it('should increase queue size by enqueued count', async function () { await sleep(1000) const sizeBefore = await wtsqs.size()