Skip to content

feat: allows a number to be entered in terminateVisibilityTimeout for… #498

feat: allows a number to be entered in terminateVisibilityTimeout for…

feat: allows a number to be entered in terminateVisibilityTimeout for… #498

GitHub Actions / Test Results (20.x succeeded Oct 19, 2024 in 0s

91 passed, 0 failed and 0 skipped

Tests passed successfully

✅ test-results.json

91 tests were completed in 220ms with 91 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/tests/consumer.test.ts 91✅ 77ms

✅ test/tests/consumer.test.ts

Consumer .create
  ✅ creates a new instance of a Consumer object
Consumer .start
  ✅ ack all messages if handleMessageBatch returns void
  ✅ ack only returned messages if handleMessagesBatch returns an array
  ✅ ack the message if handleMessage returns a message with the same ID
  ✅ ack the message if handleMessage returns void
  ✅ calls deleteMessageBatch if alwaysAcknowledge is `true` and handleMessagesBatch returns an empty array
  ✅ calls the handleMessage function when a message is received
  ✅ calls the handleMessagesBatch function when a batch of messages is received
  ✅ calls the preReceiveMessageCallback and postReceiveMessageCallback function before receiving a message
  ✅ changes message visibility timeout on processing error
  ✅ consumes another message once one is processed
  ✅ consumes messages with message attribute 'ApproximateReceiveCount'
  ✅ consumes multiple messages when the batchSize is greater than 1
  ✅ deletes the message if alwaysAcknowledge is `true` and handleMessage returns an empty object
  ✅ deletes the message when the handleMessage function is called
  ✅ does not ack the message if handleMessage returns a different ID
  ✅ does not ack the message if handleMessage returns an empty object
  ✅ does not call deleteMessageBatch if handleMessagesBatch returns an empty array
  ✅ does not delete the message if shouldDeleteMessages is false
  ✅ does not include the response and metadata in the error when extendedAWSErrors is false
  ✅ does not terminate visibility timeout when `terminateVisibilityTimeout` option is false
  ✅ doesn't consume more messages when called multiple times
  ✅ doesn't consume more messages when called multiple times after stopped
  ✅ doesn't delete the message when a processing error is reported
  ✅ emit error when changing visibility timeout fails
  ✅ emit error when changing visibility timeout fails for batch handler functions
  ✅ fires a `processing_error` event when a non-`SQSError` error occurs processing a message
  ✅ fires a message_processed event when a message is successfully deleted
  ✅ fires a message_received event when a message is received
  ✅ fires a timeout event if handler function takes too long
  ✅ fires an `error` event when an `SQSError` occurs processing a message
  ✅ fires an emptyQueue event when all messages have been consumed
  ✅ fires an error event when an error occurs deleting a message
  ✅ fires an error event when an error occurs receiving a message
  ✅ fires an event when the consumer is started
  ✅ fires error event when failed to terminate visibility timeout on processing error
  ✅ fires response_processed event for each batch
  ✅ handles non-standard exceptions thrown by the handler batch function
  ✅ handles non-standard exceptions thrown by the handler function
  ✅ handles non-standard objects thrown by the handler batch function
  ✅ handles non-standard objects thrown by the handler function
  ✅ handles unexpected exceptions thrown by the handler batch function
  ✅ handles unexpected exceptions thrown by the handler function
  ✅ includes the response and metadata in the error when "extendedAWSErrors" is true
  ✅ passes in the correct visibility timeout for long running batch handler functions
  ✅ prefers handleMessagesBatch over handleMessage when both are set
  ✅ retains sqs error information
  ✅ terminate message visibility timeout on processing error
  ✅ uses the correct abort signal
  ✅ uses the correct visibility timeout for long running handler functions
  ✅ waits before repolling when a 403 error occurs
  ✅ waits before repolling when a credentials error occurs
  ✅ waits before repolling when a CredentialsProviderError error occurs
  ✅ waits before repolling when a InvalidAddress error occurs
  ✅ waits before repolling when a InvalidSecurity error occurs
  ✅ waits before repolling when a NonExistentQueue error occurs
  ✅ waits before repolling when a polling timeout is set
  ✅ waits before repolling when a QueueDoesNotExist error occurs
  ✅ waits before repolling when a RequestThrottled error occurs
  ✅ waits before repolling when a RequestThrottled error occurs
  ✅ waits before repolling when a UnknownEndpoint error occurs
Consumer .stop
  ✅ aborts requests when the abort param is true
  ✅ clears the polling timeout when stopped
  ✅ fires a stopped event a second time if started and stopped twice
  ✅ fires a stopped event only once when stopped multiple times
  ✅ stops the consumer polling for messages
  ✅ waits for in-flight messages before emitting stopped (timeout reached)
  ✅ waits for in-flight messages before emitting stopped (within timeout)
Consumer event listeners
  ✅ fires the event multiple times
  ✅ fires the events only once
Consumer logger
  ✅ logs a debug event when an event is emitted
Consumer options validation
  ✅ requires a handleMessage or handleMessagesBatch function to be set
  ✅ requires heartbeatInterval to be less than visibilityTimeout
  ✅ requires the batchSize option to be greater than 0
  ✅ requires the batchSize option to be no greater than 10
  ✅ requires visibilityTimeout to be set with heartbeatInterval
Consumer status
  ✅ returns false for `isRunning` if the consumer has been stopped
  ✅ returns the defaults before the consumer is started
  ✅ returns true for `isPolling` if the consumer is polling for messages
  ✅ returns true for `isRunning` if the consumer has not been stopped
Consumer updateOption
  ✅ does not update the batchSize if the value is less than 0
  ✅ does not update the batchSize if the value is less than 1
  ✅ does not update the batchSize if the value is more than 10
  ✅ does not update the batchSize if the value is more than 20
  ✅ does not update the pollingWaitTimeMs if the value is less than 0
  ✅ does not update the visibilityTimeout if the value is less than the heartbeatInterval
  ✅ throws an error for an unknown option
  ✅ updates the batchSize option and emits an event
  ✅ updates the pollingWaitTimeMs option and emits an event
  ✅ updates the visibilityTimeout option and emits an event
  ✅ updates the waitTimeSeconds option and emits an event