-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix FormulaWidgetUI render when data is zero #128
Conversation
When data was 0, a render was not happening, leaving the widget with the previous value, causing a bug
Pull Request Test Coverage Report for Build 676585242
💛 - Coveralls |
a60efbc
to
4c854df
Compare
@@ -3,15 +3,6 @@ import { render, screen } from '@testing-library/react'; | |||
import FormulaWidgetUI from '../../src/widgets/FormulaWidgetUI'; | |||
import { currencyFormatter } from './testUtils'; | |||
|
|||
// Mock animations |
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.
I added this cause I noticed these tests were unstable, when using the real animation steps... I guess that adding the rerender + await removes the problem, but just for you to know
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.
Yep, check this out
@@ -36,6 +27,12 @@ describe('FormulaWidgetUI', () => { | |||
expect(await screen.findByText(DATA.value)).toBeInTheDocument(); | |||
}); | |||
|
|||
test('should render the current value', async () => { | |||
const { rerender } = render(<FormulaWidgetUI data={1234} />); | |||
rerender(<FormulaWidgetUI data={0} />); |
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.
@AdriSolid I was thinking about specific tests, in a different file, for animations, not the test on the widget removing the mock, but I guess this is also nice (if we don't need to use a mock anymore)
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.
👍
When data was 0, a render was not happening, leaving the widget with the previous value, causing a bug