summaryrefslogtreecommitdiff
path: root/async
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2024-12-20 15:03:16 +0100
committerEugen Wissner <belka@caraus.de>2024-12-20 15:03:16 +0100
commit738f4f2bdb7228b8f2f9bd74979adf361cf1b293 (patch)
treead138a085dddc0d42c53044aa70c3e4606ced9c4 /async
parent53e4c5dba6ede90f0e23b192350b3cc833834523 (diff)
downloadcucumber-js-demo-738f4f2bdb7228b8f2f9bd74979adf361cf1b293.tar.gz
Switch to ESM
Diffstat (limited to 'async')
-rw-r--r--async/features/steps/async.js7
-rw-r--r--async/features/steps/request.js4
2 files changed, 9 insertions, 2 deletions
diff --git a/async/features/steps/async.js b/async/features/steps/async.js
index 5642862..68e130d 100644
--- a/async/features/steps/async.js
+++ b/async/features/steps/async.js
@@ -4,6 +4,9 @@ import axios from 'axios'
When('I request the same resource twice', async function () {
const url = 'http://localhost:8080/'
- this.first = await axios.request(url).data
- this.second = await axios.request(url).data
+ const firstResponse = await axios.request(url)
+ this.first = firstResponse.data
+
+ const secondResponse = await axios.request(url)
+ this.second = secondResponse.data
})
diff --git a/async/features/steps/request.js b/async/features/steps/request.js
index e05014c..92879d3 100644
--- a/async/features/steps/request.js
+++ b/async/features/steps/request.js
@@ -21,5 +21,9 @@ When('I request the same resource three times', function () {
Then('the responses should be the same', function () {
expect(this.first).to.equal(this.second)
+
+ if (this.third === undefined) {
+ return
+ }
expect(this.second).to.equal(this.third)
})