website icon indicating copy to clipboard operation
website copied to clipboard

feat: add test for combine tools script

Open vishvamsinh28 opened this issue 1 year ago • 5 comments

This PR adds test for combine tools script.

Summary by CodeRabbit

  • New Features

    • Introduced new tools data structures for testing purposes, enhancing the testing framework.
    • Added new entries in JSON files for automated and manual tools, including "Tool A" and "Tool B".
    • Enhanced directory handling in various scripts to ensure directories exist before writing files.
    • Updated file writing methods to be asynchronous for improved performance.
  • Bug Fixes

    • Improved error handling in the combineTools function to catch exceptions and log validation errors.
  • Tests

    • Implemented a comprehensive suite of unit tests for the combineTools function to ensure reliability and correctness.
    • Updated tests to maintain consistency in path construction and enhance robustness in setup and teardown processes.

vishvamsinh28 avatar Aug 09 '24 03:08 vishvamsinh28

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
Latest commit 98f3238284329e0ad5290751fca7bd87be6e28b5
Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67569b9e07c1db0008919172
Deploy Preview https://deploy-preview-3136--asyncapi-website.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Aug 09 '24 03:08 netlify[bot]

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 47
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3136--asyncapi-website.netlify.app/

asyncapi-bot avatar Aug 09 '24 04:08 asyncapi-bot

Walkthrough

The changes in this pull request introduce enhanced error handling to the combineTools function in scripts/tools/combine-tools.js by adding a try-catch block. This modification ensures that exceptions are caught and logged, providing descriptive error messages. Additionally, a new file, combineToolsData.js, is created to export various data structures related to tools. New entries are also added to the JSON files for automated and manual tools, and a comprehensive suite of unit tests is introduced for the combineTools function.

Changes

File Path Change Summary
scripts/tools/combine-tools.js Modified combineTools function to include a try-catch block for error handling and logging validation errors.
tests/fixtures/combineToolsData.js Added constants for tools, languages, and technologies, including various categories and attributes of tools.
tests/fixtures/tools/automated-tools.json Introduced a new JSON structure with a category and a tool named "Tool B" with associated filters and a repository URL.
tests/fixtures/tools/manual-tools.json Added a new tool entry "Tool A" with metadata including programming language, technology, and a repository URL.
tests/tools/combine-tools.test.js Introduced unit tests for the combineTools function covering various scenarios, including error handling and validation.

Possibly related PRs

  • #3265: The changes in this PR involve enhancing error handling in the convertTools function, which is similar to the introduction of a try-catch block in the combineTools function in the main PR, indicating a focus on improving error management in tool processing.
  • #3297: This PR also updates file writing operations to use asynchronous methods, similar to the changes made in the main PR where file operations are included within a try block to ensure they only execute if no errors occur during processing.
  • #3422: This PR addresses file accessibility issues in tests related to both the build-tools and newsroom video scripts, which aligns with the main PR's focus on improving error handling and ensuring that file operations are executed correctly without errors.

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • akshatnema
  • magicmatatjahu
  • sambhavgupta0705
  • anshgoyalevil
  • Mayaleeeee
  • devilkiller-ag
  • asyncapi-bot-eve

🐰 In the code, we now take care,
With try-catch blocks, no need to despair!
Tools combined with data so bright,
Errors logged, everything feels right.
From "Tool A" to "Tool B," we cheer,
A hop of joy, for changes are here! 🥕


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.

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 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.

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[bot] avatar Oct 04 '24 05:10 coderabbitai[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.22%. Comparing base (cd391cc) to head (98f3238). Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3136      +/-   ##
==========================================
+ Coverage   70.18%   77.22%   +7.04%     
==========================================
  Files          21       21              
  Lines         664      663       -1     
==========================================
+ Hits          466      512      +46     
+ Misses        198      151      -47     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 15 '24 17:10 codecov[bot]

@vishvamsinh28 You need to check what caused this workflow to fail

Additionally, can we upload base reports for each PR, or does that work as a one time process for a new repo. Kindly research on that and fix

anshgoyalevil avatar Oct 15 '24 17:10 anshgoyalevil

@coderabbitai resolve

akshatnema avatar Nov 01 '24 12:11 akshatnema

:white_check_mark: Actions performed

Comments resolved.

coderabbitai[bot] avatar Nov 01 '24 12:11 coderabbitai[bot]

@coderabbitai full review

akshatnema avatar Nov 01 '24 12:11 akshatnema

:white_check_mark: Actions performed

Full review triggered.

coderabbitai[bot] avatar Nov 01 '24 12:11 coderabbitai[bot]

@akshatnema applied suggested changes

vishvamsinh28 avatar Dec 09 '24 07:12 vishvamsinh28

/rtm

akshatnema avatar Dec 09 '24 18:12 akshatnema