Skip to content

Commit cba2d78

Browse files
authored
add test cases for WithHttpInfo (#732)
1 parent 7acd9ee commit cba2d78

File tree

11 files changed

+5297
-539
lines changed

11 files changed

+5297
-539
lines changed

generator/src/main/resources/line-bot-sdk-nodejs-generator/api_test.pebble

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{# @pebvariable name="imports" type="java.util.List<java.util.Map<String, String>>" #}
22
{# @pebvariable name="operations" type="org.openapitools.codegen.model.OperationMap" #}
3+
{# @pebvariable name="authMethods" type="java.util.ArrayList<org.openapitools.codegen.CodegenSecurity>" -#}
34
import { {{operations.classname}} } from "../../api";
45

56
{% for import in imports -%}
@@ -35,10 +36,10 @@ const channel_access_token = "test_channel_access_token";
3536
{% endif -%}
3637
{% endmacro %}
3738

38-
39-
describe("{{operations.classname}}", () => {
40-
{% for op in operations.operation %}
41-
it("{{op.nickname}}", async () => {
39+
{% macro renderTest(operations, op, authMethods, withHttpInfo) %}
40+
{# @pebvariable name="withHttpInfo" type="java.lang.Boolean" #}
41+
{# @pebvariable name="op" type="org.openapitools.codegen.CodegenOperation" #}
42+
it("{{op.nickname}}{% if withHttpInfo %}WithHttpInfo{% endif %}", async () => {
4243
let requestCount = 0;
4344

4445
const server = createServer((req, res) => {
@@ -101,7 +102,7 @@ describe("{{operations.classname}}", () => {
101102
baseURL: `http://localhost:${String(serverAddress.port)}/`
102103
});
103104

104-
const res = await client.{{op.nickname}}(
105+
const res = await client.{{op.nickname}}{% if withHttpInfo %}WithHttpInfo{% endif %}(
105106
{% for param in op.allParams -%}
106107
{{ paramDummyValue(param) }}
107108
{% endfor %}
@@ -111,5 +112,11 @@ describe("{{operations.classname}}", () => {
111112
server.close();
112113
});
113114

115+
{% endmacro %}
116+
117+
describe("{{operations.classname}}", () => {
118+
{% for op in operations.operation %}
119+
{{ renderTest(operations, op, authMethods, true) }}
120+
{{ renderTest(operations, op, authMethods, false) }}
114121
{% endfor %}{# op #}
115122
});

0 commit comments

Comments
 (0)