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

Development: Update client tests documentation #9913

Merged
merged 8 commits into from
Dec 2, 2024

Conversation

JohannesWt
Copy link
Contributor

@JohannesWt JohannesWt commented Nov 29, 2024

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • I documented the TypeScript code using JSDoc style.

Motivation and Context

Regarding the Client Migration Process the client test documentation should also be updated.

Description

This PR updates the client tests documentation to the newest Angular standards.
Updated documentation page

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Summary by CodeRabbit

  • Documentation
    • Updated guidelines for client testing practices using Jest in Angular.
    • Enhanced clarity on asynchronous module configuration and best practices for component isolation.
    • Revised examples illustrating good and bad testing practices.
    • Updated HTTP testing recommendations to align with the latest Angular standards.
    • Expanded guidelines on naming conventions and verification functions for improved error messaging.

@JohannesWt JohannesWt self-assigned this Nov 29, 2024
@JohannesWt JohannesWt marked this pull request as ready for review November 29, 2024 22:46
@JohannesWt JohannesWt requested a review from a team as a code owner November 29, 2024 22:46
Copy link

coderabbitai bot commented Nov 29, 2024

Walkthrough

The changes in this pull request focus on enhancing the client-tests.rst documentation to improve client testing practices using Jest in Angular. Key updates include the use of async and await in the beforeEach setup, removal of .then() chaining, and revisions to examples of testing practices. The document now recommends using provideHttpClient() and provideHttpClientTesting() for HTTP testing, along with guidelines for naming conventions and error message verification. These modifications aim to streamline the testing process and promote best practices.

Changes

File Path Change Summary
docs/dev/guidelines/client-tests.rst Updated to improve clarity and efficiency of client testing practices. Introduced async and await in beforeEach, removed .then() chaining, revised examples of good/bad practices, and replaced HttpClientTestingModule with provideHttpClient() and provideHttpClientTesting(). Added recommendations for naming conventions and verification functions.

Possibly related PRs

Suggested labels

ready to merge

Suggested reviewers

  • florian-glombik
  • SimonEntholzer
  • muradium
  • krusche

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c0d109f and 231f643.

📒 Files selected for processing (1)
  • docs/dev/guidelines/client-tests.rst (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/dev/guidelines/client-tests.rst

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 or @coderabbitai title 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.

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

🧹 Outside diff range and nitpick comments (3)
docs/dev/guidelines/client-tests.rst (3)

62-79: Consider enhancing the "bad practice" example explanation.

While the example effectively demonstrates performance issues, consider adding explicit warnings about:

  • Why ArtemisTestModule should be avoided in component tests
  • The impact of importing production modules on test isolation

159-168: Consider adding context for HTTP testing changes.

While the updated HTTP testing example correctly uses modern Angular providers, consider adding:

  • Why provideHttpClient() is preferred over HttpClientTestingModule
  • Benefits of the new approach

228-238: Consider enhancing the template override warning.

While the example clearly shows what not to do, consider adding:

  • Why testing with the actual template is important
  • Common issues that arise from template overrides
  • Alternative approaches for template-related testing challenges
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9270bc0 and c0d109f.

📒 Files selected for processing (1)
  • docs/dev/guidelines/client-tests.rst (7 hunks)
🔇 Additional comments (3)
docs/dev/guidelines/client-tests.rst (3)

Line range hint 22-36: LGTM! Clear and modern test setup example.

The updated TestBed configuration example demonstrates best practices by:

  • Using async/await pattern for better readability
  • Properly structuring component initialization
  • Following Angular's recommended testing patterns

Line range hint 97-117: LGTM! Excellent demonstration of test optimization.

The example effectively shows:

  • Proper use of mock components and testing modules
  • Significant performance improvements (25x faster)
  • Clear separation of concerns

Line range hint 1-368: LGTM! Comprehensive and well-structured documentation update.

The documentation successfully:

  • Aligns with modern Angular testing practices
  • Provides clear examples of best practices and anti-patterns
  • Includes practical performance considerations
  • Offers specific guidance for common testing scenarios

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 29, 2024
docs/dev/guidelines/client-tests.rst Outdated Show resolved Hide resolved
docs/dev/guidelines/client-tests.rst Outdated Show resolved Hide resolved
docs/dev/guidelines/client-tests.rst Outdated Show resolved Hide resolved
docs/dev/guidelines/client-tests.rst Outdated Show resolved Hide resolved
@krusche krusche changed the title General: Update client tests documentation Development: Update client tests documentation Nov 30, 2024
@krusche krusche added this to the 7.7.4 milestone Nov 30, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 30, 2024
Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

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

updated documentation LGTM 👍

Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

LGTM changes. I would also want to recommend adding a table of content for better clarity

@krusche krusche added ready to merge maintainer-approved The feature maintainer has approved the PR labels Dec 2, 2024
@krusche krusche merged commit 32d001a into develop Dec 2, 2024
13 of 14 checks passed
@krusche krusche deleted the chore/update-client-tests-documentation branch December 2, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

5 participants