OBPIH-5231 Add front-end unit tests for Wizard and Menu components#3701
OBPIH-5231 Add front-end unit tests for Wizard and Menu components#3701awalkowiak merged 8 commits intodevelopfrom
Conversation
jmiranda
left a comment
There was a problem hiding this comment.
Great idea @awalkowiak
@alannadolny Can you explain why you deleted the jar file?
|
@jmiranda my blind guess: this is some weird issue after IDE setup. I locally created a fresh branch from develop and cherry-picked these commits and this lib removal change is no longer there. Plus, as you can see currently this |
| { | ||
| _.map(props.title, element => ( | ||
| <span style={{ color: element.color }}> | ||
| <span key={element} style={{ color: element.color }}> |
There was a problem hiding this comment.
I would avoid using Objects as component keys since key should be a primitive value like number or string and should be unique.
Maybe use element.text instead.
Although in this case it shouldn't be a problem since these title element don't really change all that much but keep that in mind.
src/js/tests/menu/Logo.test.jsx
Outdated
| renderedLogo = renderer.create(<Router><Logo logoUrl="" store={store} /></Router>); | ||
| }); | ||
|
|
||
| it('test if logo matches snapshot', () => { |
There was a problem hiding this comment.
When naming it(...) test lets use should naming convention like:
it('should match logo snapshot', () => { ... })
it('should render logo component correctly', () => { ... })
so that we know what should be the expected result of the test based on the title
src/js/tests/menu/Logo.test.jsx
Outdated
| import Logo from 'components/Layout/Logo'; | ||
|
|
||
| let renderedLogo; | ||
| describe('test logo component', () => { |
There was a problem hiding this comment.
"test logo component" test is probably redundant in the title
src/js/tests/menu/Menu.test.jsx
Outdated
| }); | ||
|
|
||
| it('test if collapseMenuItem and dropdownMenuItem are correctly rendering', () => { | ||
| expect(renderedMenuItem.root.findByProps({ className: 'collapse-nav-item nav-item justify-content-center align-items-center d-flex d-md-none' })) |
There was a problem hiding this comment.
I am not sure that checking if component is correctly rendered based on className props is a good idea.
I think a better solution would be to add a data-testid attribute to colapsable and drodown menu items and query them based on this id, and if you find it then it is rendered and if you don't then it is not
0a3bda7 to
e7ccf71
Compare
No description provided.