Skip to content

chore: adopted new file structure and update README and example.js with postmanClient and hoppscotchClient.#1476

Closed
Light13008 wants to merge 22 commits into
asyncapi:masterfrom
Light13008:postmanClient-hopscotchClient
Closed

chore: adopted new file structure and update README and example.js with postmanClient and hoppscotchClient.#1476
Light13008 wants to merge 22 commits into
asyncapi:masterfrom
Light13008:postmanClient-hopscotchClient

Conversation

@Light13008

@Light13008 Light13008 commented Apr 6, 2025

Copy link
Copy Markdown
Contributor

Description
-This PR follows the new file structure and all the necessary endpoints were updated.
-Only updated for javascript.
-postman-client and hoppscotch-client were added with respective README.md
-To work on echo we first need to adapt to the new file structure.
-Old pr made on this had to be canceled because of sudden update in file structure.
Fixes #1373

Related issue(s)

Fixes #1373

Summary by CodeRabbit

  • Documentation

    • Updated the README to clarify example import paths for the JavaScript WebSocket client and refined wording for better clarity.
  • Bug Fixes

    • Fixed import statements in the example and acceptance tests to specify exact client files for accurate module loading.
  • Tests

    • Enhanced test organization by segregating output into distinct directories and standardizing generated client file names.

@changeset-bot

changeset-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8d0491d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Apr 6, 2025

Copy link
Copy Markdown

"""

Walkthrough

This change updates the JavaScript WebSocket client template by modifying import paths in the example and documentation to reference the specific client.js file within the generated client directory. It also reorganizes the integration tests to generate and validate outputs for both Postman and Hoppscotch clients in separate directories, standardizing file names and updating test logic accordingly. No changes were made to exported or public entity declarations.

Changes

File(s) Change Summary
packages/templates/clients/websocket/javascript/README.md Updated example path in documentation to require custom-client-hoppscotch.js instead of previous path.
packages/templates/clients/websocket/javascript/example.js Added blank lines around import and function for readability; no logic changes.
packages/templates/clients/websocket/javascript/test/integration.test.js Refactored test output directories for Postman, Hoppscotch, and custom clients; updated file checks and names accordingly.
packages/templates/clients/websocket/test/javascript/acceptance.test.js Changed import path to explicitly require client-hoppscotch/client.js; no other code changes.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant Generator
    participant FileSystem

    TestRunner->>Generator: Generate client for Postman (output: client-postman/client.js)
    Generator->>FileSystem: Write client.js to client-postman directory
    TestRunner->>Generator: Generate client for Hoppscotch (output: client-hoppscotch/client.js)
    Generator->>FileSystem: Write client.js to client-hoppscotch directory
    TestRunner->>Generator: Generate custom Hoppscotch client (output: custom-client-hoppscotch/custom-client-hoppscotch.js)
    Generator->>FileSystem: Write custom-client-hoppscotch.js to custom-client-hoppscotch directory
    TestRunner->>FileSystem: Read client.js and README.md from each directory
    TestRunner->>TestRunner: Run snapshot tests on outputs
Loading

Assessment against linked issues

Objective Addressed Explanation
Generate both postman-echo and hopscotch-echo clients and README.md in separate folders (#1373)
Update snapshot tests to check for README.md in both outputs (#1373)

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • magicmatatjahu
  • jonaslagoni
  • asyncapi-bot-eve
  • derberg

Poem

In the warren of code, I hop with delight,
Paths now explicit, the imports are right.
Tests split and tidy, each client in place,
README and client.js—no more a wild chase!
With whiskers a-twitch and a satisfied cheer,
This bunny declares: the changes are clear! 🐇
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🔭 Outside diff range comments (7)
packages/templates/clients/websocket/javascript/test/integration.test.js (7)

32-33: 🛠️ Refactor suggestion

Update test to use the new directory structure.

The test still reads the client file from the old location. Consider updating it to use the new testResultPathPostman constant.

-    const client = await readFile(path.join(testResultPath, testOutputFile), 'utf8');
+    const client = await readFile(path.join(testResultPathPostman, testOutputFile), 'utf8');
     expect(client).toMatchSnapshot();

49-50: 🛠️ Refactor suggestion

Update test to use the new directory structure.

Similar to the previous test, this one also reads the client file from the old location. Consider updating it to use the new testResultPathHoppscotch constant.

-    const client = await readFile(path.join(testResultPath, testOutputFile), 'utf8');
+    const client = await readFile(path.join(testResultPathHoppscotch, testOutputFile), 'utf8');
     expect(client).toMatchSnapshot();

65-69: 🛠️ Refactor suggestion

Update test to use the new directory structure.

This test should also be updated to use the new directory structure for consistency.

-    const clientOutputFile = path.join(testResultPath, defaultOutputFile);
+    const clientOutputFile = path.join(testResultPathClient, defaultOutputFile);
 
     const checkClientOutputFileExists = await stat(clientOutputFile);
 
     expect(checkClientOutputFileExists.isFile()).toBeTruthy();

22-28: 🛠️ Refactor suggestion

Update Generator initialization to use the new path constants.

For the first test case, update the Generator initialization to use the new testResultPathPostman constant.

-    const generator = new Generator(template, testResultPath, {
+    const generator = new Generator(template, testResultPathPostman, {
       forceWrite: true,
       templateParams: {
         server: 'echoServer',
         clientFileName: testOutputFile
       }
     });

39-45: 🛠️ Refactor suggestion

Update Generator initialization to use the new path constants.

For the second test case, update the Generator initialization to use the new testResultPathHoppscotch constant.

-    const generator = new Generator(template, testResultPath, {
+    const generator = new Generator(template, testResultPathHoppscotch, {
       forceWrite: true,
       templateParams: {
         server: 'echoServer',
         clientFileName: testOutputFile
       }
     });

56-61: 🛠️ Refactor suggestion

Update Generator initialization to use the new path constants.

For the third test case, update the Generator initialization to use the new testResultPathClient constant.

-    const generator = new Generator(template, testResultPath, {
+    const generator = new Generator(template, testResultPathClient, {
       forceWrite: true,
       templateParams: {
         server: 'echoServer',
       }
     });

75-80: 🛠️ Refactor suggestion

Update Generator initialization to use the new path constants.

For consistency, update the Generator initialization in the fourth test case as well.

-    const generator = new Generator(template, testResultPath, {
+    const generator = new Generator(template, testResultPathHoppscotch, {
       forceWrite: true,
       templateParams: {
         clientFileName: testOutputFile
       }
     });
🧹 Nitpick comments (11)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Improve readability with proper punctuation and articles.

The added explanatory text would benefit from improved grammar to enhance clarity for users.

-> By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js');` and run `node example.js` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API.
+> By default, this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js');` and run `node example.js` again. You will see the example still works, but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...n node example.js again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/client-postman.js (4)

12-12: Consider simplifying the class name to avoid redundancy.

The class name PostmanEchoWebSocketClientClient contains a redundant "Client" suffix.

-class PostmanEchoWebSocketClientClient {
+class PostmanEchoWebSocketClient {

Remember to also update the export statement at the end of the file:

-module.exports = PostmanEchoWebSocketClientClient;
+module.exports = PostmanEchoWebSocketClient;

61-68: Fix method documentation comment.

The comment above this method incorrectly states it's for registering error handlers, but it's actually for message handlers.

-  // Method to register custom error handlers
+  // Method to register custom message handlers
   registerMessageHandler(handler) {
     if (typeof handler === 'function') {
       this.messageHandlers.push(handler);
     } else {
       console.warn('Message handler must be a function');
     }
   }

25-29: Add connection state tracking.

The connect method doesn't track the connection state, which could lead to multiple connection attempts or attempts to use a disconnected socket.

   connect() {
     return new Promise((resolve, reject) => {
+      if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
+        console.log('Already connected to Postman Echo WebSocket Client server');
+        resolve();
+        return;
+      }
+
       this.websocket = new WebSocket(this.url);

       // On successful connection
       this.websocket.onopen = () => {
         console.log('Connected to Postman Echo WebSocket Client server');
         resolve();
       };

90-96: Return a Promise from the close method for consistency.

For consistency with the connect method, consider making the close method return a Promise as well.

   // Method to close the WebSocket connection
   close() {
-    if (this.websocket) {
-      this.websocket.close();
-      console.log('WebSocket connection closed.');
-    }
+    return new Promise((resolve) => {
+      if (!this.websocket) {
+        console.log('No WebSocket connection to close.');
+        resolve();
+        return;
+      }
+      
+      this.websocket.onclose = () => {
+        console.log('WebSocket connection closed.');
+        this.websocket = null;
+        resolve();
+      };
+      
+      this.websocket.close();
+    });
   }
packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/README.md (1)

37-44: Consider adding response type information.

The documentation for sendEchoMessage could be enhanced by specifying what type of response to expect after sending a message. This would help users understand the complete request-response cycle.

packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/README.md (2)

5-5: Fix typo in overview section.

There's a typo in "Undestand" which should be "Understand".

-Undestand how to use Hoppscotch Echo WebSocket as a client. Hoppscotch Echo WebSocket server echoes back any messages sent to it. You can use this to test WebSocket connections and message flows.
+Understand how to use Hoppscotch Echo WebSocket as a client. Hoppscotch Echo WebSocket server echoes back any messages sent to it. You can use this to test WebSocket connections and message flows.

39-39: Add missing article in the sentence.

Missing "the" before "server" makes the sentence grammatically incorrect.

-Receive the timestamp message sent from server every second.
+Receive the timestamp message sent from the server every second.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~39-~39: You might be missing the article “the” here.
Context: ...Receive the timestamp message sent from server every second. Example: ```javascr...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js (3)

59-60: Correct method comment for registerMessageHandler.

The method comment incorrectly states this is for registering error handlers, but it's actually for message handlers.

-  // Method to register custom error handlers
+  // Method to register custom message handlers
  registerMessageHandler(handler) {

83-85: Consider JSON handling consistency with documentation.

The sendEchoMessage method uses JSON.stringify on all messages, but the README example (line 53) implies sending a simple string. This inconsistency could cause confusion. Consider either:

  1. Updating the method to handle both string and object types, or
  2. Clarifying in the documentation that all messages are automatically JSON-stringified
  sendEchoMessage(message) {
-    this.websocket.send(JSON.stringify(message));
+    const payload = typeof message === 'string' ? message : JSON.stringify(message);
+    this.websocket.send(payload);
    console.log('Sent message to echo server:', message);
  }

77-80: Simplify the handleMessage method.

The current implementation is a simple wrapper that only calls the callback if it exists. This pattern is already used in other methods like the WebSocket's onmessage handler. Consider inlining this logic to reduce unnecessary abstraction.

-  // Method to handle message with callback
-  handleMessage(message, cb) {
-    if (cb) cb(message);
-  }

And update line 35:

-            this.handleMessage(event.data, handler);
+            handler(event.data);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85ddcd7 and da45d4d.

📒 Files selected for processing (7)
  • packages/templates/clients/websocket/javascript/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/example.js (1 hunks)
  • packages/templates/clients/websocket/javascript/test/integration.test.js (1 hunks)
  • packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js (1 hunks)
  • packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/client-postman.js (1 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
packages/templates/clients/websocket/javascript/test/integration.test.js (1)
packages/templates/clients/websocket/python/test/integration.test.js (1)
  • path (5-5)
packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js (2)
packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/client-postman.js (1)
  • WebSocket (10-10)
packages/templates/clients/websocket/javascript/example.js (1)
  • message (26-26)
🪛 LanguageTool
packages/templates/clients/websocket/javascript/README.md

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...n node example.js again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/README.md

[uncategorized] ~39-~39: You might be missing the article “the” here.
Context: ...Receive the timestamp message sent from server every second. Example: ```javascr...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🔇 Additional comments (2)
packages/templates/clients/websocket/javascript/example.js (1)

1-1: LGTM! Import path updated to reflect new directory structure.

The path to the client module has been correctly updated to match the new file structure, which aligns with the PR objective to recreate the file structure.

packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/postmanClient/README.md (1)

46-93: Good implementation of the client testing example.

The example provides a comprehensive demonstration of the client usage, including message and error handling, connection establishment, and a robust approach to sending messages periodically with proper error handling.

Comment thread packages/templates/clients/websocket/javascript/test/integration.test.js Outdated
Comment on lines +38 to +45
#### `handleTimeStampMessage(payload)`
Receive the timestamp message sent from server every second.


**Example:**
```javascript
client.handleTimeStampMessage("test");
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Verify the implementation of handleTimeStampMessage.

The README documents a handleTimeStampMessage function, but there doesn't appear to be a corresponding implementation in the client-hoppscotch.js file. Additionally, the example shows this method being used with a string parameter "test", but the description suggests it's for receiving messages, not sending them.


🏁 Script executed:

#!/bin/bash
# Check if the handleTimeStampMessage method is implemented in the client-hoppscotch.js file
grep -n "handleTimeStampMessage" packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult/hoppscotchClient/client-hoppscotch.js

Length of output: 147


Missing Implementation for handleTimeStampMessage in Client
It appears that the README documents a handleTimeStampMessage method with an example usage (client.handleTimeStampMessage("test")), yet no implementation was found in the corresponding client file. This discrepancy raises two concerns:

  • Implementation Gap:
    The client-hoppscotch.js file does not contain any implementation of handleTimeStampMessage. Please verify if this method is defined elsewhere or if it was accidentally omitted.

  • API Inconsistency:
    The example passes a string parameter ("test"), which conflicts with the description that indicates the method should handle timestamp messages received from the server. Clarification is needed on whether the method is intended to process incoming messages rather than be invoked with a test string.

Please review and update the implementation or documentation accordingly.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~39-~39: You might be missing the article “the” here.
Context: ...Receive the timestamp message sent from server every second. Example: ```javascr...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

@Light13008

Copy link
Copy Markdown
Contributor Author

@derberg @ItshMoh could you please let me know if this approach is aligned with what’s planned, or if there's a different direction I should follow? Just looking for a green or red flag before continuing further. Thanks in advance!

@Light13008 Light13008 changed the title chore: recreate old file structure and update README and example.js chore: adopted new file structure and update README and example.js with postmanClient and hoppscotchClient. Apr 7, 2025
@Light13008

Light13008 commented Apr 8, 2025

Copy link
Copy Markdown
Contributor Author

@derberg @ItshMoh any comments on this work.
any suggestions ?
because when i tried running npm run test, it automataically deleted postmanClient and hoppscotchClient files that i had added.

@Light13008
Light13008 force-pushed the postmanClient-hopscotchClient branch from fd25e4b to 77a43a4 Compare April 8, 2025 04:35
@Light13008
Light13008 requested a review from ItshMoh April 10, 2025 08:28
Comment thread packages/templates/clients/websocket/javascript/README.md Outdated
Comment thread packages/templates/clients/websocket/javascript/README.md Outdated
@Light13008
Light13008 force-pushed the postmanClient-hopscotchClient branch from c6fab20 to 1337ae5 Compare April 12, 2025 05:13
@Light13008
Light13008 requested a review from ItshMoh April 12, 2025 05:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Refine README text for clarity and minor grammatical improvements.

Consider updating this line by inserting a comma after "By default", adding the definite article "the" before "Postman echo service" and before "first line", and inserting a comma before "but" to separate independent clauses. This will improve readability and conform to standard English grammar. For example:

- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./test/temp/snapshotTestResult/hoppscotch-client/client-hoppscotch.js');` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API.
+ > By default, this is testing against the Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/hoppscotch-client/client-hoppscotch.js');` again. You will see that the example still works, but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...t-hoppscotch.js');` again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6fab20 and c0dffa9.

📒 Files selected for processing (4)
  • apps/generator/lib/generator.js (1 hunks)
  • packages/templates/clients/websocket/javascript/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/example.js (2 hunks)
  • packages/templates/clients/websocket/javascript/test/integration.test.js (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/templates/clients/websocket/javascript/example.js
  • apps/generator/lib/generator.js
  • packages/templates/clients/websocket/javascript/test/integration.test.js
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/javascript/README.md

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...t-hoppscotch.js');` again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

@Light13008
Light13008 force-pushed the postmanClient-hopscotchClient branch from c0dffa9 to 3d73066 Compare April 12, 2025 06:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Improve Documentation Clarity & Grammar in the Example Note

The updated example now correctly points to the postman-client library, resolving the earlier naming discrepancy. However, there are a few grammatical improvements to boost clarity and readability:

  • Insert a comma after “By default” and add the article “the” before “Postman Echo service.”
  • Consider removing the word “again” after the import path instruction.
  • Insert a comma before “but” in the sentence “You will see example still works but now it is using a different API.” This will better separate the independent clauses.

For instance, below is a suggested diff to refine the text:

- > By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./test/temp/snapshotTestResult/postman-client/client-postman.js');` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API.
+ > By default, this is testing against the Postman Echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/postman-client/client-postman.js');`. You will see that the example still works, but now it uses a different API. This is possible since both AsyncAPI documents define the same operation name (`sendEchoMessage`), so each generated client has the same API.

These changes will ensure the README is both technically correct and easier to understand.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...ient-postman.js');` again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0dffa9 and 3d73066.

📒 Files selected for processing (2)
  • packages/templates/clients/websocket/javascript/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/example.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/templates/clients/websocket/javascript/example.js
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/javascript/README.md

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: You might be missing the article “the” here.
Context: ...ocket/javascript/example.jsand change first line toconst WSClient = require('./te...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...ient-postman.js');` again. You will see example still works but now it is using a diffe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... again. You will see example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

@ItshMoh

ItshMoh commented Apr 12, 2025

Copy link
Copy Markdown
Contributor

LGTM 👍

const asyncapi_v3_path_postman = path.resolve(__dirname, './__fixtures__/asyncapi-postman-echo.yml');
const asyncapi_v3_path_hoppscotch = path.resolve(__dirname, './__fixtures__/asyncapi-hoppscotch-echo.yml');
const testResultPath = path.resolve(__dirname, './temp/snapshotTestResult');
const testResultPathPostman = path.join(testResultPath, 'postman-client');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this and below to client- - I mean that name of folder starts and not ends with client

also, since you introduce folders that contain the name of the service, I guess client-postman.js' and the other can also be changed?

so we end up with

  • client-postman/client.js
  • client-hoppscotch/client.js

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okkie

Comment thread apps/generator/lib/generator.js Outdated
Comment on lines +12 to +13
const npmResolvedPath = requireg.resolve('npm') || '';
const npmPath = npmResolvedPath ? npmResolvedPath.replace('index.js', '') : '';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change needed in this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While running the tests on the main Generator project, I encountered a 'resolve' related issue. I was able to identify and resolve it locally. However, since this issue is unrelated to the changes introduced in this PR, I will remove the corresponding fix from this pull request .

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Enhance sentence clarity and formatting

  • Insert a comma after “By default,” and before “but” for proper compound-sentence punctuation.
  • Wrap the require statement in a fenced code block to improve readability.

Suggested diff:

> By default, this is testing against the Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to:

+```js
+const WSClient = require('./test/temp/snapshotTestResult/client-postman/client.js');
+```

>You will see the example still works, but now it is using a different API. This is possible since both AsyncAPI documents define the same operation name for sending messages: `sendEchoMessage`, so each client generated has the same API.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1db853f and c34b6d5.

📒 Files selected for processing (3)
  • packages/templates/clients/websocket/javascript/README.md (1 hunks)
  • packages/templates/clients/websocket/javascript/example.js (2 hunks)
  • packages/templates/clients/websocket/javascript/test/integration.test.js (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/templates/clients/websocket/javascript/example.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/templates/clients/websocket/javascript/test/integration.test.js
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/javascript/README.md

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
🔇 Additional comments (1)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Correct Postman client require path to match new file structure
The updated path ./test/temp/snapshotTestResult/client-postman/client.js aligns with the reorganized output directory and ensures that example.js will correctly load the generated Postman client.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Postman echo se...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

@derberg derberg moved this to In Progress in Maintainers work Apr 30, 2025
@Light13008
Light13008 requested a review from derberg May 3, 2025 22:38
4. Start example script that uses a client library generated by the test: `node example.js`

> By default this is testing against Hoppscotch echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./tests/temp/snapshotTestResult/client-postman.js');` and run `node example.js` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. No newline at end of file
> By default this is testing against Postman echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/client-postman/client.js');` and run `node example.js` again. You will see the example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Light13008 actually in example.js it is discussed to keep HoppscotchClient generate by custom-client.
Discussion - #1513 (review)

@@ -1,4 +1,6 @@
const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');

const WSClient = require('./test/temp/snapshotTestResult/client-postman/client.js');

@Adi-204 Adi-204 May 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change import also accordingly.

const testResultPathPostman = path.join(testResultPath, 'client-postman');
const testResultPathHoppscotch = path.join(testResultPath, 'client-hoppscotch');
const testResultPathClient = path.join(testResultPath, 'client');
const template = path.resolve(__dirname, '../');

@Adi-204 Adi-204 May 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add const testResultPathCustomHoppscotch = path.join(testResultPath, 'custom_client_hoppscotch'); and change path in below testcase also where you are generating custom path.

For ref - #1513

you can also see other websocket integration test.

@Light13008
Light13008 requested a review from Adi-204 May 6, 2025 04:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/templates/clients/websocket/javascript/README.md (1)

9-9: Improve clarity and punctuation in the instruction.

Add a comma after “By default”, a comma before “but” in the second sentence, and consider adding “the” before “Hoppscotch echo service” for consistency. For example:

- > By default this is testing against Hoppscotch echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');` and run `node example.js` again. You will see the example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.
+ > By default, this is testing against the Hoppscotch echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to:
+ > 
+ > ```js
+ > const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');
+ > ```
+ > 
+ > Then run `node example.js` again. You will see the example still works, but now it is using a different API. This is possible since both AsyncAPI documents define the same operation name for sending messages (`sendEchoMessage`), so each generated client has the same API.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: `node example.js`  > By default this is testing against Hoppscotch echo...

(BY_DEFAULT_COMMA)

---

[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

</details>

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between f87f1c2b91f014f96639bc787a26caece848e15d and d666c5c92dd37fd0c6677de1cc1ec7d501a01af1.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `packages/templates/clients/websocket/javascript/README.md` (1 hunks)
* `packages/templates/clients/websocket/javascript/example.js` (2 hunks)
* `packages/templates/clients/websocket/javascript/test/integration.test.js` (5 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* packages/templates/clients/websocket/javascript/example.js

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* packages/templates/clients/websocket/javascript/test/integration.test.js

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>packages/templates/clients/websocket/javascript/README.md</summary>

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: `node example.js`  > By default this is testing against Hoppscotch echo...

(BY_DEFAULT_COMMA)

---

[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (2)</summary>

* GitHub Check: Test generator as dependency with Node 20
* GitHub Check: Test generator as dependency with Node 18

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>packages/templates/clients/websocket/javascript/README.md (1)</summary>

`9-9`: <details>
<summary>❓ Verification inconclusive</summary>

**Verify the example.js require path matches the actual generated output.**

Ensure that `custom-client-hoppscotch.js` exists under `test/temp/snapshotTestResult`. If the directory or filename differs (e.g., `client-hoppscotch/client.js`), update the path accordingly.

---

🏁 Script executed:

```shell
#!/bin/bash
# Verify the presence and path of the generated Hoppscotch client file
fd custom-client-hoppscotch.js packages/templates/clients/websocket/javascript

Length of output: 80


🏁 Script executed:

#!/bin/bash
# List any snapshotTestResult directories and their JavaScript contents
find packages/templates/clients/websocket/javascript -type d -name 'snapshotTestResult' -exec echo "Directory: {}" \; -exec find {} -maxdepth 1 -type f -name '*.js' -print \;

# Search the entire repo for the expected generated file
fd custom-client-hoppscotch.js .

# As a fallback, list all files under test/temp to see actual names
find packages/templates/clients/websocket/javascript/test/temp -type f -print

Length of output: 386


Confirm README require path for generated client
I couldn’t locate custom-client-hoppscotch.js under packages/templates/clients/websocket/javascript/test/temp/snapshotTestResult. Please verify the actual generated file name and its relative path, then update the example in the README accordingly.

Locations to review:

  • packages/templates/clients/websocket/javascript/README.md (line 9)

Suggested diff if the path differs:

- const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');
+ const WSClient = require('<correct/relative/path/to/generated-client.js>');
🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: Did you mean: “By default,”?
Context: ...rated by the test: node example.js > By default this is testing against Hoppscotch echo...

(BY_DEFAULT_COMMA)


[uncategorized] ~9-~9: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...in. You will see the example still works but now it is using a different API. This i...

(COMMA_COMPOUND_SENTENCE)

@@ -1,4 +1,6 @@

const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to me we are generating clients inside folders then custom_client_hoppscotch should be folder and inside it will have client.js just like other clients than how this import is working?
you can look at other clients.

4. Start example script that uses a client library generated by the test: `node example.js`

> By default this is testing against Hoppscotch echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change first line to `const WSClient = require('./tests/temp/snapshotTestResult/client-postman.js');` and run `node example.js` again. You will see example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API. No newline at end of file
> By default this is testing against Hoppscotch echo service. You can modify `packages/templates/clients/websocket/javascript/example.js` and change the first line to `const WSClient = require('./test/temp/snapshotTestResult/custom-client-hoppscotch.js');` and run `node example.js` again. You will see the example still works but now it is using a different API. This is possible since both AsyncAPI documents define the same name of operation for sending messages: `sendEchoMessage`, so each client generated has the same API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just small change by default this is testing against Hoppscotch echo service then in changes we should give Postman.
Changes - the first line to const WSClient = require('./test/temp/snapshotTestResult/client_postman/client.js');

just read complete instruction once and you will understand what I am trying to say.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, postman, not custom-client-hoppscotch.js


it('generate simple client for hoppscotch echo', async () => {
const testOutputFile = 'client-hoppscotch.js';
const testOutputFile = 'custom-client-hoppscotch.js';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep consistency in testing across clients. So keep structure similar like other clients where we created folder and inside it always client.js file.

Just refer to other clients generated structure and you will get better idea.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it for now. These integration tests are over duplicated.

I already tried to generalize a bit, and introduces listFiles in my latest PR: https://github.com/asyncapi/generator/blob/master/packages/templates/clients/websocket/python/test/integration.test.js#L35

we need a separate issue that experiments how we can have one integration.test.js for all clients

@Adi-204

Adi-204 commented May 6, 2025

Copy link
Copy Markdown
Member

@derberg in integration.test.js for javascript we will have 3 testcases just like other client postman, hoppscotch and custom hoppscotch but we have written 2 additional testcases

  1. without clientFileName param
  2. should throw an error when server param is missing during simple client generation for hoppscotch echo

so my question is are we considering to write testcases for all params or for now simplicity it is fine to remove testcases for params and only 3 testcases.

Then we can remove above mention 2 testcases I mention in this comment. wdyt 🤔?
@Light13008 share your thoughts also.

@derberg

derberg commented May 6, 2025

Copy link
Copy Markdown
Member

@Adi-204 I don't think this is in scope of this PR. Please look at #1476 (comment) -> imho we need separate discussion

@Adi-204

Adi-204 commented May 6, 2025

Copy link
Copy Markdown
Member

@derberg yeah I just dropped my thoughts we can create a discussion issue

@Light13008
Light13008 requested a review from Adi-204 May 6, 2025 14:40
@derberg

derberg commented May 7, 2025

Copy link
Copy Markdown
Member

@Light13008 there is one readme comment you need to address

and sorry for changing my mind, I misunderstood it initially, I agree with @Adi-204 regarding the output structure, each should be in individual folder, so instead of ./test/temp/snapshotTestResult/custom-client-hoppscotch.js result should go as ./test/temp/snapshotTestResult/custom-client-hoppscotch/client.js. Please update it in this PR. What I mention about listFiles will actually not have any effect on the output

@Light13008

Light13008 commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

@derberg @Adi-204 , sorry for the delay,
anything else apart form this #1476 change that should take care of ?
could you please give me a final instruction of how i should proceed further, and what i should make a note of before proceeding.

i will be starting to work as soon i get a final go from anyone of you.

asking this because the comment history has created a lot of chaos 😨

@Adi-204

Adi-204 commented May 10, 2025

Copy link
Copy Markdown
Member

@Light13008 you need to do following changes -

  1. In README.md mention here - chore: adopted new file structure and update README and example.js with postmanClient and hoppscotchClient. #1476 (comment)

  2. In latest PR of @derberg he introduce new helper listFiles in integration test of python have a look at - https://github.com/asyncapi/generator/blob/master/packages/templates/clients/websocket/python/test/integration.test.js
    you can add it in this PR.

  3. The output structure of your current code is wrong, each should be in individual folder, so instead of ./test/temp/snapshotTestResult/custom-client-hoppscotch.js result should go as ./test/temp/snapshotTestResult/custom-client-hoppscotch/client.js.

So basically I would suggest to have a look at python integration test and majority of code will be just copy and paste but we are going to solve this code duplication in "other PR" (not in the scope of the issue this PR is solving).

In js integration test we do have 2 extra testcases for params but don't change anything in those for now. It is not in the scope of the issue this PR is solving, we can discuss it in issue - #1549

@derberg

derberg commented May 14, 2025

Copy link
Copy Markdown
Member

@Light13008 some of the scope, related to acceptance test will be solved with #1552 so wait until this PR is merged and then just fix the structure discussed above

@sonarqubecloud

Copy link
Copy Markdown

@derberg

derberg commented May 19, 2025

Copy link
Copy Markdown
Member

closing this PR
@Light13008 lost access to his GH account and won't be able to continue here

@derberg derberg closed this May 19, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Maintainers work May 19, 2025
@derberg derberg moved this from Done to Archive in Maintainers work May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Archive

Development

Successfully merging this pull request may close these issues.

[FEATURE] To add the generation of both postman-echo and hopscotch-echo in snapshot.test.js file of packages/template

5 participants