-
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
test: Add SystemLabel object type test #1772
Conversation
Warning Rate limit exceeded@oskogstad has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 11 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new unit test class 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: 0
🧹 Nitpick comments (1)
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/SystemLabelTests.cs (1)
16-22
: Consider making the test more robust.The current implementation assumes enum values are declared in the same order. Consider these improvements:
- Compare sets instead of ordered lists
- Add more descriptive error messages
- Consider adding specific test cases using [Theory]
Here's a suggested implementation:
// Assert - Assert.Equal(domainTypes.Count, graphQlTypes.Count); + Assert.Equal(domainTypes.Count, graphQlTypes.Count, + "The number of system labels must match between GraphQL and domain layers"); - for (var i = 0; i < domainTypes.Count; i++) - { - Assert.Equal(domainTypes[i].ToString(), graphQlTypes[i].ToString()); - } + var domainValues = domainTypes.Select(x => x.ToString()).ToHashSet(); + var graphQlValues = graphQlTypes.Select(x => x.ToString()).ToHashSet(); + + Assert.True(domainValues.SetEquals(graphQlValues), + "The system label values must match exactly between GraphQL and domain layers");Additionally, consider adding specific test cases:
[Theory] [InlineData(DomainSystemLabel.YourEnumValue)] public void Specific_System_Label_Must_Match_Domain_Type(DomainSystemLabel domainType) { // Arrange var graphQlType = Enum.Parse<SystemLabel>(domainType.ToString()); // Assert Assert.Equal(domainType.ToString(), graphQlType.ToString()); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/SystemLabelTests.cs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build / build-and-test
🔇 Additional comments (2)
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/SystemLabelTests.cs (2)
1-5
: LGTM! Clean imports with good use of aliasing.The use of aliasing for the domain type helps avoid ambiguity and improves readability.
7-24
: LGTM! Important test for maintaining layer consistency.The test effectively ensures that GraphQL and domain enums stay in sync, which is crucial for maintaining consistency across layers.
No description provided.