zero-ui icon indicating copy to clipboard operation
zero-ui copied to clipboard

Test/front end tests

Open davidlag0 opened this issue 2 years ago • 3 comments

Pull Request type

Please check the type of change your PR introduces:

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no API changes)
  • [ ] Build-related changes
  • [ ] Documentation content changes
  • [x] Other (please describe): Tests

What is the current behavior?

Issue Number: #135

What is the new behavior?

  • No behavior change. Some production code was adjusted to make testing possible.

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Regarding Bar.jsx, I will need help understanding how lines 96, 102, and 137 should run. I was not able to find such cases so I could not build tests to cover these specific lines. Testing is mostly done from the perspective of the user and a bit more deeply for utility functions. If a code path in a frontend component cannot be reached, potential refactoring might be required.

davidlag0 avatar Jun 12 '23 12:06 davidlag0

Thanks for your PR, @davidlag0!

Regarding Bar.jsx, I will need help understanding how lines 96, 102, and 137 should run

Could you write down your question in detail, please? Could not find figure out what is the problem with these lines.

dec0dOS avatar Jun 13 '23 11:06 dec0dOS

Thanks for your PR, @davidlag0!

Regarding Bar.jsx, I will need help understanding how lines 96, 102, and 137 should run

Could you write down your question in detail, please? Could not find figure out what is the problem with these lines.

Yes, where should I click in the UI to be able to run the code on lines 96, 102 and 137? To run all the other code, for example, I simulate a logged in user and the click on the menu to show the "Log out" choice then click on it, etc. I haven't found how I'm able to use the UI to reach the code paths that would include lines 96, 102 and 137. If there's a way and you can tell me, I will simply write tests catered to these lines. If there is no way to have these lines executed by using the UI, often, it is a sign that refactoring is required, potentially to remove some code that cannot be reached.

Thanks!

davidlag0 avatar Jun 26 '23 23:06 davidlag0

This code path couldn't be reached now, as it should be used for internal pages that are currently absent: https://github.com/dec0dOS/zero-ui/blob/8785b94392e5de87b21fa93c81752ef67acc10f1/frontend/src/components/Bar/Bar.jsx#L45-L49

The current PR version looks good to me.

dec0dOS avatar Jun 27 '23 13:06 dec0dOS