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

front: tests: add tests for formatSignalingSystems function #6919

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

Uriel-Sautron
Copy link
Contributor

@Uriel-Sautron Uriel-Sautron commented Mar 15, 2024

close #6920

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 48.97959% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 28.99%. Comparing base (f9decc7) to head (968b7f6).

Files Patch % Lines
...rc/applications/editor/tools/pointEdition/types.ts 0.00% 12 Missing ⚠️
...rc/applications/editor/tools/pointEdition/utils.ts 75.00% 1 Missing and 7 partials ⚠️
.../pointEdition/components/PointEditionLeftPanel.tsx 0.00% 5 Missing ⚠️
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     
Flag Coverage Δ
core 79.80% <ø> (ø)
editoast 74.86% <ø> (-0.02%) ⬇️
front 9.21% <48.97%> (+0.05%) ⬆️
gateway 2.49% <ø> (ø)
railjson_generator 87.15% <ø> (ø)
tests 83.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@clarani clarani left a 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)

@Uriel-Sautron Uriel-Sautron marked this pull request as ready for review March 20, 2024 13:28
@Uriel-Sautron Uriel-Sautron requested a review from a team as a code owner March 20, 2024 13:28
Copy link
Contributor

@Yohh Yohh left a 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

@Uriel-Sautron Uriel-Sautron force-pushed the usn/test-unitaire-formating-signaling-systems branch 2 times, most recently from 9be6159 to 737f342 Compare March 20, 2024 14:51
Copy link
Contributor

@Yohh Yohh left a comment

Choose a reason for hiding this comment

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

LGTM, tested 💪

Copy link
Contributor

@clarani clarani left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 🙏

⚠️ Don't forget to squash your commits

fix comments

- rename function formatSignalingSystems to formatSignalingSystem
- formatSignalingSystem now takes a parameter of type SignalingSystemForm
@Uriel-Sautron Uriel-Sautron force-pushed the usn/test-unitaire-formating-signaling-systems branch from 737f342 to 968b7f6 Compare March 21, 2024 07:59
@clarani clarani added this pull request to the merge queue Mar 21, 2024
Merged via the queue into dev with commit 1809799 Mar 21, 2024
22 checks passed
@clarani clarani deleted the usn/test-unitaire-formating-signaling-systems branch March 21, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

front: editor: tests for formatSignalingSystems function
3 participants