Skip to content

Commit

Permalink
Update unit tests with the correct expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescapps committed Aug 13, 2021
1 parent 6a23fab commit d17e194
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ describe('Consumer', () => {

});

it('extends visibility timeout for long running handler functions', async () => {
it('uses the correct visibility timeout for long running handler functions', async () => {
consumer = new Consumer({
queueUrl: 'some-queue-url',
region: 'some-region',
Expand All @@ -641,17 +641,17 @@ describe('Consumer', () => {
sandbox.assert.calledWith(sqs.changeMessageVisibility, {
QueueUrl: 'some-queue-url',
ReceiptHandle: 'receipt-handle',
VisibilityTimeout: 70
VisibilityTimeout: 40
});
sandbox.assert.calledWith(sqs.changeMessageVisibility, {
QueueUrl: 'some-queue-url',
ReceiptHandle: 'receipt-handle',
VisibilityTimeout: 100
VisibilityTimeout: 40
});
sandbox.assert.calledOnce(clearIntervalSpy);
});

it('extends visibility timeout for long running batch handler functions', async () => {
it('passes in the correct visibility timeout for long running batch handler functions', async () => {
sqs.receiveMessage = stubResolve({
Messages: [
{ MessageId: '1', ReceiptHandle: 'receipt-handle-1', Body: 'body-1' },
Expand All @@ -677,17 +677,17 @@ describe('Consumer', () => {
sandbox.assert.calledWith(sqs.changeMessageVisibilityBatch, {
QueueUrl: 'some-queue-url',
Entries: [
{ Id: '1', ReceiptHandle: 'receipt-handle-1', VisibilityTimeout: 70 },
{ Id: '2', ReceiptHandle: 'receipt-handle-2', VisibilityTimeout: 70 },
{ Id: '3', ReceiptHandle: 'receipt-handle-3', VisibilityTimeout: 70 }
{ Id: '1', ReceiptHandle: 'receipt-handle-1', VisibilityTimeout: 40 },
{ Id: '2', ReceiptHandle: 'receipt-handle-2', VisibilityTimeout: 40 },
{ Id: '3', ReceiptHandle: 'receipt-handle-3', VisibilityTimeout: 40 }
]
});
sandbox.assert.calledWith(sqs.changeMessageVisibilityBatch, {
QueueUrl: 'some-queue-url',
Entries: [
{ Id: '1', ReceiptHandle: 'receipt-handle-1', VisibilityTimeout: 100 },
{ Id: '2', ReceiptHandle: 'receipt-handle-2', VisibilityTimeout: 100 },
{ Id: '3', ReceiptHandle: 'receipt-handle-3', VisibilityTimeout: 100 }
{ Id: '1', ReceiptHandle: 'receipt-handle-1', VisibilityTimeout: 40 },
{ Id: '2', ReceiptHandle: 'receipt-handle-2', VisibilityTimeout: 40 },
{ Id: '3', ReceiptHandle: 'receipt-handle-3', VisibilityTimeout: 40 }
]
});
sandbox.assert.calledOnce(clearIntervalSpy);
Expand Down

0 comments on commit d17e194

Please sign in to comment.