From 78315fd8c05ddbd805a8065c402644292aa1f219 Mon Sep 17 00:00:00 2001 From: Diana Thayer Date: Tue, 30 Nov 2021 16:45:59 -0800 Subject: [PATCH] respond to feedback --- merged/aws-sdk/lib/v3-sqs.js | 7 +-- .../tests/versioned/aws-sdk-v3/sqs.tap.js | 60 ++++++++----------- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/merged/aws-sdk/lib/v3-sqs.js b/merged/aws-sdk/lib/v3-sqs.js index 8363ce8a45..edac4237c3 100644 --- a/merged/aws-sdk/lib/v3-sqs.js +++ b/merged/aws-sdk/lib/v3-sqs.js @@ -90,11 +90,8 @@ function sqsMiddleware(shim, next, context) { * @returns {Object} */ function getSqsSpec(shim, original, name, args) { - const [ - { - input: { QueueUrl } - } - ] = args + const [command] = args + const { QueueUrl } = command.input return { callback: shim.LAST, destinationName: grabLastUrlSegment(QueueUrl), diff --git a/merged/aws-sdk/tests/versioned/aws-sdk-v3/sqs.tap.js b/merged/aws-sdk/tests/versioned/aws-sdk-v3/sqs.tap.js index 38c26819dc..fc57e0d19e 100644 --- a/merged/aws-sdk/tests/versioned/aws-sdk-v3/sqs.tap.js +++ b/merged/aws-sdk/tests/versioned/aws-sdk-v3/sqs.tap.js @@ -3,8 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -// TODO restore attribute checking, see checkAttributes - 'use strict' const tap = require('tap') @@ -77,36 +75,32 @@ tap.test('SQS API', (t) => { }) t.test('commands with promises', async (t) => { - try { - // create queue - const createParams = getCreateParams(queueName) - const createCommand = new CreateQueueCommand(createParams) - const { QueueUrl } = await sqs.send(createCommand) - t.ok(QueueUrl) - // run send/receive commands in transaction - await helper.runInTransaction(async (transaction) => { - // send message - const sendMessageParams = getSendMessageParams(QueueUrl) - const sendMessageCommand = new SendMessageCommand(sendMessageParams) - const { MessageId } = await sqs.send(sendMessageCommand) - t.ok(MessageId) - // send message batch - const sendMessageBatchParams = getSendMessageBatchParams(QueueUrl) - const sendMessageBatchCommand = new SendMessageBatchCommand(sendMessageBatchParams) - const { Successful } = await sqs.send(sendMessageBatchCommand) - t.ok(Successful) - // receive message - const receiveMessageParams = getReceiveMessageParams(QueueUrl) - const receiveMessageCommand = new ReceiveMessageCommand(receiveMessageParams) - const { Messages } = await sqs.send(receiveMessageCommand) - t.ok(Messages) - // wrap up - transaction.end() - await finish(t, transaction) - }) - } catch (err) { - t.error(err) - } + // create queue + const createParams = getCreateParams(queueName) + const createCommand = new CreateQueueCommand(createParams) + const { QueueUrl } = await sqs.send(createCommand) + t.ok(QueueUrl) + // run send/receive commands in transaction + await helper.runInTransaction(async (transaction) => { + // send message + const sendMessageParams = getSendMessageParams(QueueUrl) + const sendMessageCommand = new SendMessageCommand(sendMessageParams) + const { MessageId } = await sqs.send(sendMessageCommand) + t.ok(MessageId) + // send message batch + const sendMessageBatchParams = getSendMessageBatchParams(QueueUrl) + const sendMessageBatchCommand = new SendMessageBatchCommand(sendMessageBatchParams) + const { Successful } = await sqs.send(sendMessageBatchCommand) + t.ok(Successful) + // receive message + const receiveMessageParams = getReceiveMessageParams(QueueUrl) + const receiveMessageCommand = new ReceiveMessageCommand(receiveMessageParams) + const { Messages } = await sqs.send(receiveMessageCommand) + t.ok(Messages) + // wrap up + transaction.end() + await finish(t, transaction) + }) }) function finish(t, transaction) { @@ -134,8 +128,6 @@ tap.test('SQS API', (t) => { checkName(t, receiveMessage.name, 'Consume', queueName) checkAttributes(t, receiveMessage, 'ReceiveMessageCommand') - - t.end() } })