Change:
I found a subtle bug while doing the “React: Write a Simple Counter” challenge. If you look at the code below you’ll see that I binded this in to the this .decrement method. It should be: The consequence of this error is that clicking the reset button which calls does not reset the counter and decrements it instead. However, when I run the tests, all the tests are passed and the error is not detected! I think we need to add an additional test for that specific scenario. Browser Name: Chrome Browser Version: 67 Operating System: Mac OS X
I run to this same error just now. Accidentally, I entered which is wrong but it passed the test.
I think we need to check this with a RegEx. What are your opinions and ?
Is there any update on this issue? I could work on this bug.
As of yet, we have not come to a conclusion about what to do on this issue. Although, since this is a confirmed issue, please suggest how you'd like to go ahead with this over here
In terms of the buggy code provided in this issue, I think only the last test case is wrong. Left part is the original version. Right part is the new version I made. ! I checked if my changes work on local host. After I made the change, we can see that the last test fails when I provide the wrong solution codes. ! And the last test passes when I provide the correct solution codes. !
This looks pretty good to me. I see you've made a PR, that's great, we'll QA that soon

Discussion:
- text: Clicking the decrement button should decrement the count by <code>1</code>. testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const first = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const second = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await first(); const secondValue = await second(); assert(firstValue === 0 && secondValue === -1, ''Clicking the decrement button should decrement the count by <code>1</code>.''); }; ' - text: Clicking the reset button should reset the count to <code>0</code>. <del> testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const init = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const increment = () => { mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const decrement = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const reset = () => { mockedComponent.find(''.reset'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await init(); const secondValue = await increment(); const thirdValue = await decrement(); const fourthValue = await reset(); assert(firstValue === 0 && secondValue === 2 && thirdValue === 1 && fourthValue === 0, ''Clicking the reset button should reset the count to <code>0</code>.''); }; ' </del> <ins> testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(Counter)); const init = () => { mockedComponent.setState({ count: 0 }); return waitForIt(() => mockedComponent.state(''count'')); }; const increment = () => { mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); mockedComponent.find(''.inc'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const decrement = () => { mockedComponent.find(''.dec'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const reset = () => { mockedComponent.find(''.reset'').simulate(''click''); return waitForIt(() => mockedComponent.state(''count'')); }; const firstValue = await init(); const secondValue = await increment(); const thirdValue = await decrement(); const fourthValue = await reset(); assert(firstValue === 0 && secondValue === 3 && thirdValue === 2 && fourthValue === 0, ''Clicking the reset button should reset the count to <code>0</code>.''); }; ' </ins> ```