Skip to content

Conversation

@amnambiar
Copy link
Collaborator

@amnambiar amnambiar commented Apr 16, 2024

Pull request template

Description

Child issues of PLT-9572 focusing on NavBar Component-
PLT-9587
PLT-9586
PLT-9585
PLT-9597

Checklist

  • Commit messages broadly make sense and follow the Conventional Commits format.
  • PR targets master/develop
  • New tests are added for the changes (if not, mention it in the PR description). These may include:
    • Unit tests,
    • Integration tests,
    • Property-Based testing,
    • End-to-end tests.
  • The new version builds and passes all tests. If not, please mention it in the PR description.
  • Self review of the code has been done.
  • Reviewer has been requested.
  • Ticket in Jira is in Review and sub-task for the reviewer has been created and assigned.

Summary by CodeRabbit

  • Documentation

    • Updated the project's README to reflect new metrics percentages.
  • Tests

    • Added tests for the NavBar component to verify active menu items and content display based on user roles.

@amnambiar amnambiar requested a review from a team as a code owner April 16, 2024 09:38
@amnambiar amnambiar requested review from KJES4 and removed request for a team April 16, 2024 09:38
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 16, 2024

Walkthrough

This update includes modifications to the project documentation and enhancements in testing for the NavBar component. The documentation now accurately reflects updated metrics on code coverage, while the test file for the NavBar adds various checks for UI elements and user interactions based on different user roles.

Changes

File Summary
README.md Updated code coverage percentages for statements, branches, functions, and lines.
src/.../NavBar.test.tsx Added tests for NavBar component, focusing on active menu items, content display based on user roles, and handling user scenarios.

Recent Review Details

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between db7c63f and 6b648d2.
Files selected for processing (2)
  • README.md (1 hunks)
  • src/pages/session/components/NavBar.test.tsx (1 hunks)
Additional comments not posted (7)
README.md (1)

5-5: Update to coverage metrics is clear and well-presented.

Consider aligning the percentage values for a cleaner look in the table.

src/pages/session/components/NavBar.test.tsx (6)

10-16: The test case for applying the active class to selected menu items is correctly implemented.


18-26: The test case for not applying the active class when the menu item is not active is correctly implemented.


28-60: The test case for displaying "Running" in the "Testing" menu item when a test campaign is active is well-implemented with appropriate state mocking.


62-98: The test case for displaying "Metrics" and "Support Commands" for admin users is correctly implemented with appropriate role mocking.


100-136: The test case for displaying "Support Commands" only for support users is well-implemented and correctly tests the conditional visibility based on user roles.


138-147: The test case for displaying "Audit Report Upload" for users with the "l2-upload-report" feature is correctly implemented.


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.

@amnambiar
Copy link
Collaborator Author

@KJES4

Here tests fail with error

src/pages/session/components/NavBar.test.tsx:90:17 - error TS2322: Type '{ profile: null; errorMessage: null; loading: false; success: false; selectedUser: null; allUsers: null; loadingDetails: false; detailsSuccess: false; detailsError: null; userSubscription: null; ... 8 more ...; impersonate: false; }' is not assignable to type 'ProfileState'.
Object literal may only specify known properties, and 'profileBalance' does not exist in type 'ProfileState'.

90                 profileBalance: 0,

But, it passes locally. As profileBalance is present in the type ProfileState

,"/--local--/dapps-certification-web/src/pages/session/components/NavBar.tsx": {"lines":{"total":33,"covered":25,"skipped":0,"pct":75.75},"functions":{"total":16,"covered":8,"skipped":0,"pct":50},"statements":{"total":41,"covered":33,"skipped":0,"pct":80.48},"branches":{"total":28,"covered":26,"skipped":0,"pct":92.85}}

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