Skip to content

Commit 24b7dfd

Browse files
committed
chore: use list queues with prefix
1 parent d33c8d9 commit 24b7dfd

File tree

3 files changed

+15
-29
lines changed

3 files changed

+15
-29
lines changed

features/sqs/messages.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ Feature: SQS Messages
55
I want to be able to send and process messages.
66

77
Scenario: Send an SQS message
8-
Given I create a queue with the prefix name "aws-js-sdk"
8+
Given I create a queue with prefix "aws-js-sdk"
99
When I send the message "HELLO"
1010
Then the result should include a message ID
1111
And the result should have an MD5 digest of "eb61eead90e3b899c6bcbe27ac581660"
1212
And I should eventually be able to receive "HELLO" from the queue
1313

1414
Scenario: Binary payloads
15-
Given I create a queue with the prefix name "aws-js-sdk"
15+
Given I create a queue with prefix "aws-js-sdk"
1616
When I send the message "HELLO" with a binary attribute
1717
Then the result should include a message ID
1818
And the result should have an MD5 digest of "eb61eead90e3b899c6bcbe27ac581660"

features/sqs/queues.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Feature: SQS Queues
55
I want to be able to create, list and delete queues.
66

77
Scenario: Creating and deleting queues
8-
Given I create a queue with the prefix name "aws-js-sdk"
9-
And I create a queue with the prefix name "aws-js-sdk"
10-
Then list queues should eventually return the queue urls
8+
Given I create a queue with prefix "aws-js-sdk"
9+
And I create a queue with prefix "aws-js-sdk"
10+
Then list queues with prefix "aws-js-sdk" should return queue urls
Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
const { Given, Then } = require("@cucumber/cucumber");
2+
const { equal } = require("assert");
23

3-
Given("I create a queue with the prefix name {string}", async function (prefix) {
4+
Given("I create a queue with prefix {string}", async function (prefix) {
45
const name = this.uniqueName(prefix);
5-
const response = await this.service.createQueue({ QueueName: name });
6-
this.queueUrl = response.QueueUrl;
7-
this.createdQueues.push(this.queueUrl);
6+
const { QueueUrl } = await this.service.createQueue({ QueueName: name });
7+
this.queueUrl = QueueUrl;
8+
this.createdQueues.push(QueueUrl);
89
});
910

10-
Then("list queues should eventually return the queue urls", function (callback) {
11-
this.eventually(
12-
callback,
13-
function (next) {
14-
next.condition = function () {
15-
let matchingCount = 0;
16-
for (let i = 0; i < this.createdQueues.length; ++i) {
17-
for (let j = 0; j < this.data.QueueUrls.length; ++j) {
18-
if (this.createdQueues[i] == this.data.QueueUrls[j]) {
19-
matchingCount++;
20-
}
21-
}
22-
}
23-
return matchingCount == this.createdQueues.length;
24-
};
25-
26-
this.request(null, "listQueues", {}, next);
27-
},
28-
{ maxTime: 60 }
29-
);
11+
Then("list queues with prefix {string} should return queue urls", async function (prefix) {
12+
const { QueueUrls } = await this.service.listQueues({ QueueNamePrefix: prefix });
13+
for (const queueUrl of this.createdQueues) {
14+
equal(QueueUrls.includes(queueUrl), true);
15+
}
3016
});

0 commit comments

Comments
 (0)