Skip to content

Commit a5415f0

Browse files
committed
Add feature test to check idempotency in created course events
1 parent be37d69 commit a5415f0

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

tests/apps/mooc_backend/features/courses_counter/get-courses-counter.feature

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,67 @@ Feature: Obtain the total number of courses
3030
"total": 1
3131
}
3232
"""
33+
34+
Scenario: With more than one course having duplicates
35+
Given I send an event to the event bus:
36+
"""
37+
{
38+
"data": {
39+
"id": "c77fa036-cbc7-4414-996b-c6a7a93cae09",
40+
"type": "course.created",
41+
"occurred_on": "2019-08-08T08:37:32+00:00",
42+
"attributes": {
43+
"id": "8c900b20-e04a-4777-9183-32faab6d2fb5",
44+
"name": "DDD en PHP!",
45+
"duration": "25 hours"
46+
},
47+
"meta" : {
48+
"host": "111.26.06.93"
49+
}
50+
}
51+
}
52+
"""
53+
And I send an event to the event bus:
54+
"""
55+
{
56+
"data": {
57+
"id": "8c4a4ed8-9458-489e-a167-b099d81fa096",
58+
"type": "course.created",
59+
"occurred_on": "2019-08-09T08:36:32+00:00",
60+
"attributes": {
61+
"id": "8c4a4ed8-9458-489e-a167-b099d81fa096",
62+
"name": "DDD en Java!",
63+
"duration": "24 hours"
64+
},
65+
"meta" : {
66+
"host": "111.26.06.93"
67+
}
68+
}
69+
}
70+
"""
71+
And I send an event to the event bus:
72+
"""
73+
{
74+
"data": {
75+
"id": "8c4a4ed8-9458-489e-a167-b099d81fa096",
76+
"type": "course.created",
77+
"occurred_on": "2019-08-09T08:36:32+00:00",
78+
"attributes": {
79+
"id": "8c4a4ed8-9458-489e-a167-b099d81fa096",
80+
"name": "DDD en Java!",
81+
"duration": "24 hours"
82+
},
83+
"meta" : {
84+
"host": "111.26.06.93"
85+
}
86+
}
87+
}
88+
"""
89+
When I send a GET request to "/courses-counter"
90+
Then the response status code should be 200
91+
And the response content should be:
92+
"""
93+
{
94+
"total": 2
95+
}
96+
"""

0 commit comments

Comments
 (0)