Skip to content

Commit b554206

Browse files
committed
test: add tests for missing server parameter
1 parent 5f1e08e commit b554206

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

packages/templates/clients/websocket/java/quarkus/.ageneratorrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v3
22
parameters:
33
server:
44
description: The name of the server described in AsyncAPI document
5-
required: false
5+
required: true
66
appendClientSuffix:
77
description: Add 'Client' suffix at the end of the class name. This option has no effect if 'customClientName' is specified.
88
required: false

packages/templates/clients/websocket/test/integration-test/common-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ function runCommonTests(language, config) {
5959
await generateAndVerifyClient(config.template, outputPath, asyncapiPath, params);
6060
});
6161
});
62+
63+
describe('When required server param is missing', () => {
64+
it('should throw an error when server param is missing during client generation', async () => {
65+
const generator = new Generator(config.template, config.testResultPath, {
66+
forceWrite: true,
67+
});
68+
await expect(generator.generateFromFile(asyncapi_v3_path_hoppscotch)).rejects.toThrow('This template requires the following missing params: server');
69+
});
70+
});
6271
}
6372

6473
function runCommonSlackTests(language, config) {

packages/templates/clients/websocket/test/integration-test/integration.test.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ describe('WebSocket Clients Integration Tests', () => {
8181
const checkClientOutputFileExists = await stat(clientOutputFile);
8282
expect(checkClientOutputFileExists.isFile()).toBeTruthy();
8383
});
84-
85-
it('should throw an error when server param is missing during simple client generation for hoppscotch echo', async () => {
86-
const generator = new Generator(config.template, config.testResultPath, {
87-
forceWrite: true,
88-
templateParams: {
89-
clientFileName: config.clientFileName
90-
}
91-
});
92-
await expect(generator.generateFromFile(asyncapi_v3_path_hoppscotch)).rejects.toThrow('This template requires the following missing params: server');
93-
});
9484
});
9585
});
9686
});

0 commit comments

Comments
 (0)