-
Notifications
You must be signed in to change notification settings - Fork 14
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(sdl): improve fixture generation to address any further case #92
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #92 +/- ##
=======================================
Coverage 71.57% 71.57%
=======================================
Files 23 23
Lines 795 795
Branches 200 200
=======================================
Hits 569 569
Misses 217 217
Partials 9 9 ☔ View full report in Codecov by Sentry. |
}).toThrowError(new SdlValidationError(`service "web" credentials missing "${field}"`)); | ||
}); | ||
|
||
it.each(fields)('should throw an error when credentials "%s" is empty', field => { | ||
credentials[field] = ""; | ||
const yml = createSdlYml({ | ||
"services.web.credentials": { $set: credentials } |
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.
Pretty cool, I never used immutability-helper
per se. Is it strongly typed?
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.
Yes. However dot-object is not. I still used it as it's for tests and it simplified code quite a bit. If we feel like it we could add own typing there.
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.
Immutability helper is generally used to ui state management :) but it's useful in this case it seems
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.
Yea, I used immutablejs a lot in the past
🎉 This PR is included in version 0.9.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR introduces enhancements to the testability of the SDL. By leveraging the
immutability-helper
anddot-object
libraries, we have created several functions that generate testing fixtures, such as SDL configurations, groups, and manifests.Key Benefits
JSON as the Source Format: plain JSON is used for source data, which offers better manageability compared to YAML. This choice simplifies the handling of data structures.
Ease of Creating Fixtures: The new functions make it straightforward to create new fixtures while ensuring that the source data remains unchanged. This improves the reliability and reproducibility of tests.
Enhanced Tooling for JSON Mutation: With enhanced tools to mutate JSON data, these functions provide a robust framework for adjusting test data according to specific test requirements.
Future-proofing: Designed to accommodate nearly any scenario that might arise in future developments, this approach enhances the scalability and adaptability of our testing infrastructure.