Skip to content

Commit 7f06209

Browse files
committed
feat(core)!: Removed the assumption that every interaction response can be described by "returns". This is a breaking change, because it needs contracts to be re-written, and http contracts with automatically named triggers will have to change triggers from \"a (200) ..."\ to \"returns a (200) ..."\. If you need to stay compatible with contracts from before this version, you will need to provide both names in your trigger definitions
1 parent a56be77 commit 7f06209

36 files changed

Lines changed: 5715 additions & 141 deletions

File tree

package-lock.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/case-core-plugin-function/src/matchers/FunctionResultMatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const describe = (
7070
context: MatchContext,
7171
): string =>
7272
isSuccessResult(matcher)
73-
? `returning ${context.descendAndDescribe(
73+
? `returns ${context.descendAndDescribe(
7474
matcher.success,
7575
addLocation(`returnValue`, context),
7676
)}`

packages/case-core-plugin-http/src/matchers/HttpResponseMatcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ const name = (
9494
context: MatchContext,
9595
): string =>
9696
response.uniqueName
97-
? response.uniqueName
98-
: `a (${context.descendAndDescribe(
97+
? `returns ${response.uniqueName}`
98+
: `returns a (${context.descendAndDescribe(
9999
response.status,
100100
addLocation('status', context),
101101
)}) response ${

packages/case-core/case-contracts/contract-for-incorrectly-configured-examples.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
},
127127
"response": {
128128
"_case:matcher:type": "_case:Lookup",
129-
"_case:matcher:uniqueName": "a (200) response with body an object shaped like {status: \"up\"}",
129+
"_case:matcher:uniqueName": "returns a (200) response with body an object shaped like {status: \"up\"}",
130130
"_case:matcher:child": {
131131
"status": 200,
132132
"body": {
@@ -170,7 +170,7 @@
170170
},
171171
"response": {
172172
"_case:matcher:type": "_case:Lookup",
173-
"_case:matcher:uniqueName": "a (200) response with body an object shaped like {status: <any string>}",
173+
"_case:matcher:uniqueName": "returns a (200) response with body an object shaped like {status: <any string>}",
174174
"_case:matcher:child": {
175175
"status": 200,
176176
"body": {
@@ -218,7 +218,7 @@
218218
},
219219
"response": {
220220
"_case:matcher:type": "_case:Lookup",
221-
"_case:matcher:uniqueName": "a (httpStatus 4XX | 5XX) response without a body",
221+
"_case:matcher:uniqueName": "returns a (httpStatus 4XX | 5XX) response without a body",
222222
"_case:matcher:child": {
223223
"status": {
224224
"_case:matcher:type": "_case:HttpStatusCode",
@@ -264,7 +264,7 @@
264264
},
265265
"response": {
266266
"_case:matcher:type": "_case:Lookup",
267-
"_case:matcher:uniqueName": "a (503) response with body an object shaped like {status: \"down\"}",
267+
"_case:matcher:uniqueName": "returns a (503) response with body an object shaped like {status: \"down\"}",
268268
"_case:matcher:child": {
269269
"status": 503,
270270
"body": {
@@ -327,7 +327,7 @@
327327
},
328328
"response": {
329329
"_case:matcher:type": "_case:Lookup",
330-
"_case:matcher:uniqueName": "a (200) response with body an object shaped like {userId: ${userId}}",
330+
"_case:matcher:uniqueName": "returns a (200) response with body an object shaped like {userId: ${userId}}",
331331
"_case:matcher:child": {
332332
"status": 200,
333333
"body": {
@@ -383,7 +383,7 @@
383383
},
384384
"response": {
385385
"_case:matcher:type": "_case:Lookup",
386-
"_case:matcher:uniqueName": "a (404) response without a body",
386+
"_case:matcher:uniqueName": "returns a (404) response without a body",
387387
"_case:matcher:child": {
388388
"status": 404,
389389
"_case:matcher:type": "_case:HttpResponseMatcher"

0 commit comments

Comments
 (0)