-
Notifications
You must be signed in to change notification settings - Fork 46
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
front: tests: add tests for formatSignalingSystems function #6919
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #6919 +/- ##
============================================
+ Coverage 28.95% 28.99% +0.03%
Complexity 2244 2244
============================================
Files 1070 1070
Lines 132700 132711 +11
Branches 2696 2708 +12
============================================
+ Hits 38429 38481 +52
+ Misses 92707 92654 -53
- Partials 1564 1576 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Nice tests, thanks, it's a good start ! It would be nice to modify the function formatSignalingSystems (maybe rename it formatSignalingSystems => formSignalingSystem) so it takes only 1 logical_signal and format it as it might be easier to test.
// test only formatSignalingSystem
export function formatSignalingSystems(
entity: SignalEntity
): SignalEntity['properties']['logical_signals'] {
if (!entity.properties.logical_signals) return [];
return entity.properties.logical_signals.map((logicalSignal) => formatSignalingSystem(logicalSignal))
Here are the use cases I can see for now:
- handle a BAL signal without default_parameters (initialization)
- handle a BAL signal with default_parameters
- handle a BAL signal with conditional_parameters
- handle a BAL signal with default_parameters and conditional_parameters becoming a BAPR signal
- handle a BAPR signal becoming a BAL signal
- handle a modification on a BAPR signal (update of settings)
front/src/applications/editor/tools/pointEdition/__tests__/utils.spec.ts
Outdated
Show resolved
Hide resolved
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.
nice! just a few comments
front/src/applications/editor/tools/pointEdition/__tests__/utils.spec.ts
Outdated
Show resolved
Hide resolved
9be6159
to
737f342
Compare
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.
LGTM, tested 💪
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.
LGTM, thanks 🙏
fix comments - rename function formatSignalingSystems to formatSignalingSystem - formatSignalingSystem now takes a parameter of type SignalingSystemForm
737f342
to
968b7f6
Compare
close #6920