Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add some tests #43

Merged
merged 2 commits into from
May 20, 2024
Merged

feat: add some tests #43

merged 2 commits into from
May 20, 2024

Conversation

apurv-wednesday
Copy link
Contributor

@apurv-wednesday apurv-wednesday commented May 15, 2024

Summary by CodeRabbit

  • Tests

    • Added and updated test cases for ErrorBoundary, Loader, and mapKeysDeep functions to improve coverage and accuracy.
    • Ensured Loader component renders correctly and includes CircularProgress.
    • Verified IResponse interface properties in getRecommendations tests.
  • Chores

    • Updated sonar-project.properties to correct the path for the JavaScript coverage report.
    • Modified CI workflow to include SonarQube scan before testing and generating coverage reports.

Copy link

coderabbitai bot commented May 15, 2024

Walkthrough

This update primarily focuses on enhancing testing and configuration practices within the project. Key changes include the introduction of new test cases for various components and utilities, the adoption of type-only imports in TypeScript, and adjustments to the SonarQube configuration for better code quality monitoring. These improvements aim to ensure robust testing coverage and streamlined type management.

Changes

File/Path Summary
jest.config.ts Changed import statement to use TypeScript's type-only imports for Config.
src/common/ErrorBoundary/tests/index.test.tsx Added test cases for ErrorBoundary component.
src/common/Loader/tests/index.test.tsx Added new test cases for Loader component.
src/features/repos/api/tests/getRecommendations.test.ts Added test cases for IResponse interface.
src/utils/createEmotionCache.ts Moved isBrowser constant declaration inside the function.
src/utils/tests/index.test.ts Added and updated test cases for mapKeysDeep and convertObjectToCamelCase functions.
sonar-project.properties Updated path for JavaScript coverage report.
.github/workflows/ci.yml Added and rearranged steps for SonarQube scan and commented out the Quality Gate action.

In the land of code, changes bloom,
Tests and configs in full plume.
TypeScript's imports, light as air,
Ensure our types are handled with care.
With SonarQube's watchful eye,
Our quality soars high.
🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Copy link

github-actions bot commented May 15, 2024

Jest Coverage Report

St.
Category Percentage Covered / Total
🟡 Statements
63.58% (+3.42% 🔼)
316/497
🔴 Branches
52.89% (+3.31% 🔼)
64/121
🔴 Functions
59.38% (+5.21% 🔼)
57/96
🟡 Lines
67.86% (+3.32% 🔼)
266/392

Test suite run success

70 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from 2668d5a

This comment has been minimized.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 06409e9 and b6eb93b.
Files selected for processing (7)
  • jest.config.ts (1 hunks)
  • src/common/ErrorBoundary/tests/index.test.tsx (1 hunks)
  • src/common/Loader/tests/index.test.tsx (1 hunks)
  • src/features/repos/api/tests/getRecommendations.test.ts (1 hunks)
  • src/utils/createEmotionCache.ts (1 hunks)
  • src/utils/tests/createEmotionCache.test.ts (1 hunks)
  • src/utils/tests/index.test.ts (3 hunks)
Files skipped from review due to trivial changes (4)
  • jest.config.ts
  • src/common/ErrorBoundary/tests/index.test.tsx
  • src/common/Loader/tests/index.test.tsx
  • src/utils/createEmotionCache.ts
Additional comments not posted (13)
src/utils/tests/createEmotionCache.test.ts (5)

14-17: The test case for verifying the cache key looks good.


19-23: The test case for verifying the insertionPoint on the server looks good.


25-35: The test case for verifying the insertionPoint with the emotion-insertion-point meta tag looks good.


37-41: The test case for verifying the insertionPoint when the meta tag is not found looks good.


6-12: The setup and teardown code for saving and restoring the original document looks good.

src/features/repos/api/tests/getRecommendations.test.ts (3)

3-25: The test case for verifying the properties of the IResponse object looks good.


27-36: The test case for handling an empty items array in the IResponse object looks good.


38-57: The test case for handling the incompleteResults flag in the IResponse object looks good.

src/utils/tests/index.test.ts (5)

6-18: The test case for verifying the output of the mapKeysDeep function looks good.


20-23: The test case for handling arrays in the mapKeysDeep function looks good.


25-27: The test case for handling non-array and non-object values in the mapKeysDeep function looks good.


Line range hint 28-49: The test cases for verifying the behavior of the isLocal function with different values of the IS_LOCAL environment variable look good.


Line range hint 50-83: The test cases for verifying the error handling and key conversion of the convertObjectToCamelCase function look good.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b6eb93b and 23967ca.
Files selected for processing (1)
  • sonar-project.properties (1 hunks)
Files skipped from review due to trivial changes (1)
  • sonar-project.properties

This comment has been minimized.

This comment has been minimized.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 23967ca and dcc14c8.
Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • sonar-project.properties (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • sonar-project.properties
Additional comments not posted (1)
.github/workflows/ci.yml (1)

39-44: Ensure SonarQube scan action is correctly configured.

The SonarQube scan action has been added. Verify that the SONAR_TOKEN and SONAR_HOST_URL secrets are correctly set in the repository settings to ensure the scan runs successfully.

.github/workflows/ci.yml Outdated Show resolved Hide resolved

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between dcc14c8 and 28b8a24.
Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • sonar-project.properties (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci.yml
  • sonar-project.properties

This comment has been minimized.

Copy link

sonarqube-ws bot commented May 15, 2024

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (64.10% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.00% Estimated after merge)

Project ID: wednesday-solutions_next-bulletproof-ts_AY6yu6eKB2n8RRmGoUz4

View in SonarQube

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 28b8a24 and 2668d5a.
Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • sonar-project.properties (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci.yml
  • sonar-project.properties

@alichherawalla alichherawalla merged commit be46bc3 into main May 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants