-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: Add transmission content values test #1200
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces modifications to the Changes
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range comments (2)
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (1)
Line range hint
1-253
: Overall assessment: Changes meet PR objectives and improve test coverage.The added test cases effectively address the PR objective of introducing tests for required content on transmissions. They cover important scenarios:
- Attempting to create a transmission without content values.
- Attempting to create a transmission with empty localization values.
These tests enhance the project's ability to validate transmission content, which is crucial for ensuring data integrity and proper functionality.
To further strengthen the testing suite, consider adding the following test cases in the future:
- A test for mixed valid and invalid content (e.g., valid summary but empty title).
- A test for content with valid structure but invalid data (e.g., excessively long strings).
- A test for content with multiple localizations, including both valid and invalid entries.
These additional tests would provide more comprehensive coverage of potential edge cases in transmission content validation.
src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs (1)
Line range hint
246-265
: LGTM: New method GenerateFakeDialogTransmissions addedThe new
GenerateFakeDialogTransmissions
method is well-implemented and provides a good way to generate fake transmission data. It covers all necessary fields and allows for customization through optional parameters.A minor suggestion for improvement:
Consider adding a constant or configuration value for the maximum number of transmissions instead of hardcoding
4
in theGenerate
call. This would make it easier to adjust the maximum count in the future if needed.- .Generate(count ?? new Randomizer().Number(1, 4)); + private const int MaxTransmissions = 4; + // ... + .Generate(count ?? new Randomizer().Number(1, MaxTransmissions));
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (3)
- src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs (5 hunks)
- src/Digdir.Tool.Dialogporten.GenerateFakeData/Program.cs (2 hunks)
- tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (2 hunks)
🔇 Additional comments (7)
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (1)
1-1
: LGTM: New using directives are appropriate.The added using directives for localization and transmission entities are necessary for the new test methods and are correctly placed at the beginning of the file.
Also applies to: 4-4
src/Digdir.Tool.Dialogporten.GenerateFakeData/Program.cs (3)
38-38
: LGTM: Improved parameter ordering for better readability.The consolidation of parameters in the
DialogGenerator.GenerateFakeDialogs
method call enhances code readability. MovingserviceResourceGenerator
andpartyGenerator
to follow thecount
parameter creates a more logical flow and consistent style.
119-119
: LGTM: Consistent parameter ordering, but clarification needed on.Take(dialogsToGenerate)
.The parameter ordering in this
DialogGenerator.GenerateFakeDialogs
call is consistent with the change made in theRunAsync
method, which is good for maintaining code style consistency throughout the file.However, I noticed the addition of
.Take(dialogsToGenerate)
at the end of the method call. Can you clarify the purpose of this? It seems redundant since we're already specifying the count in theGenerateFakeDialogs
method. Is there a scenario where the method might return more dialogs than requested?
Line range hint
1-265
: Summary: Code improvements align with PR objectives, but verification needed for new tests.The changes in this file improve code readability and consistency, which indirectly supports the PR objective of adding transmission content values test by enhancing the code that generates fake dialogs. However, I didn't see any new tests specifically for transmission content values as mentioned in the PR objectives.
Can you please verify if there are any new tests added in other files that specifically address the transmission content values? If not, consider adding such tests to fully meet the PR objectives.
src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs (3)
39-40
: LGTM: Transmission support added to GenerateFakeDialogThe addition of the
transmissions
parameter toGenerateFakeDialog
and its propagation toGenerateFakeDialogs
is correct and consistent with the method's purpose. This change allows for optional transmission data to be included when generating a single fake dialog.Also applies to: 64-65
90-91
: LGTM: Transmission support added to GenerateFakeDialogsThe addition of the
transmissions
parameter toGenerateFakeDialogs
and the new rule for generating fake dialog transmissions are correct and consistent with the method's purpose. This change allows for optional transmission data to be included when generating multiple fake dialogs, and it correctly uses the provided transmissions or generates new ones if not provided.Also applies to: 113-113
127-128
: LGTM: Transmission support added to GenerateSimpleFakeDialogThe addition of an empty
transmissions
list toGenerateSimpleFakeDialog
is correct and consistent with the method's purpose of generating a simple fake dialog. This ensures that the method remains compatible with the updatedGenerateFakeDialog
signature while maintaining its simplicity.
...Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs
Show resolved
Hide resolved
...Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs
Show resolved
Hide resolved
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
There was a problem hiding this 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.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (1)
- tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (2 hunks)
🔇 Additional comments (3)
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (3)
230-251
: LGTM: Well-implemented test for transmission without content values.The test case correctly verifies that a transmission cannot be created with empty content values for summary and title, aligning with the PR objective. The implementation follows best practices and provides clear assertions.
As suggested in the previous review, consider adding a comment explaining why we expect exactly 2 validation errors. This would improve the test's readability and maintainability. For example:
// We expect 2 validation errors: one for empty summary and one for empty title validationError.Errors .Count(e => e.PropertyName.Contains(nameof(createDialogCommand.Content))) .Should() .Be(2);
253-274
: LGTM: Well-implemented test for transmission with empty content localization values.The test case correctly verifies that a transmission cannot be created with empty localization values for summary and title, aligning with the PR objective. The implementation follows best practices and provides clear assertions.
As suggested in the previous review, consider adding a comment explaining why we expect exactly 2 validation errors. This would improve the test's readability and maintainability. For example:
// We expect 2 validation errors: one for empty summary localization and one for empty title localization validationError.Errors .Count(e => e.PropertyName.Contains(nameof(createDialogCommand.Content))) .Should() .Be(2);
Line range hint
1-274
: Overall, excellent addition of test cases for transmission content validation.The new test methods effectively cover various scenarios for transmission content validation, aligning well with the PR objectives. They enhance the testing framework by ensuring that the necessary content values are validated during the transmission process.
To further improve the test suite:
- Consider adding tests for edge cases, such as partially filled content or content with only whitespace characters.
- Ensure that these tests are part of a comprehensive test strategy that covers all aspects of transmission content validation.
Description
Adding test for required content on transmissions
Related Issue(s)
Verification
Documentation
docs
-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)Summary by CodeRabbit
New Features
Bug Fixes
Tests