Skip to content

Commit a38bfeb

Browse files
committed
fix jsonassert
1 parent f47819d commit a38bfeb

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

generators/src/main/java/com/algolia/codegen/cts/tests/TestsRequest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ private String escapeBody(String body) {
6060
}
6161

6262
switch (language) {
63-
case "go": // jsonassert expect % to be formatted, we need to escape them
64-
return body.replace("%", "%%");
65-
case "dart": // Same thing but for $
63+
case "dart": // Escape $ to avoid being used for string interpolation
6664
return body.replace("$", "\\$");
6765
default:
6866
return body;

templates/go/tests/e2e/e2e.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func Test{{#lambda.titlecase}}{{clientPrefix}}{{/lambda.titlecase}}E2E_{{#lambda
6161
unionBodyRaw, err := json.Marshal(unionBody)
6262
require.NoError(t, err)
6363

64-
jsonassert.New(t).Assertf(string(unionBodyRaw), expectedBodyRaw)
64+
jsonassert.New(t).Assertf(string(unionBodyRaw), "%s", expectedBodyRaw)
6565
{{/body}}
6666
{{/response}}
6767
})

templates/go/tests/requests/requests.mustache

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ func Test{{#lambda.titlecase}}{{clientPrefix}}{{/lambda.titlecase}}_{{#lambda.ti
5151
require.Equal(t, "{{{method}}}", echo.Method)
5252

5353
{{#body}}
54-
ja := jsonassert.New(t)
55-
ja.Assertf(*echo.Body, `{{{.}}}`)
54+
jsonassert.New(t).Assertf(*echo.Body, "%s", `{{{.}}}`)
5655
{{/body}}
5756
{{^body}}
5857
{{#assertNullBody}}

0 commit comments

Comments
 (0)