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

<TooltipIconButton> Tests #179

Merged
merged 8 commits into from May 3, 2022

Conversation

oogali
Copy link
Contributor

@oogali oogali commented Apr 13, 2022

This PR adds the supporting infrastructure for manual mocking of components, and two tests for .

Small, optional bonus of converting from ES5 function to ES6 fat arrow function.

src/Components/Buttons.test.jsx Show resolved Hide resolved
src/__mocks__/MockComponent.jsx Outdated Show resolved Hide resolved
src/__mocks__/MockComponent.jsx Show resolved Hide resolved
* @return {Object} React component
*/
export function TooltipIconButton({
export const TooltipIconButton = ({
Copy link
Member

Choose a reason for hiding this comment

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

So we were using more modern syntax but there was something about function that worked better. I forget what. Is there a reason to prefer const here besides shorter?

Copy link
Member

Choose a reason for hiding this comment

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

I suggest reverting this to function as it's more consistent with the rest of our code. I think the rule we're using is "top-level exported functions should use function keyword". I'll add that to styleguide.

Copy link
Member

Choose a reason for hiding this comment

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

@pablo-mayrgundter pablo-mayrgundter merged commit 4399866 into bldrs-ai:main May 3, 2022
OlegMoshkovich pushed a commit to OlegMoshkovich/Share that referenced this pull request May 19, 2022
* Create manual mock for testing React components

This wraps the component with the requisite theme provider.

* Convert component to ES6 arrow function

* Add tests for <TooltipIconButton>

* Refactor to remove redundant inline wrapper

* Add internal attribute to support testing

* Add missing blank lines after imports

* Reorder file context so name of first object corresponds with filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants