Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.

Commit a20ac56

Browse files
fix(challenges): remove race condition from react lifecycle challenge
1 parent b090e8b commit a20ac56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

challenges/03-front-end-libraries/react.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,7 @@
25752575
"text":
25762576
"The <code>h1</code> tag should render the <code>activeUsers</code> value from <code>MyComponent</code>&apos;s state.",
25772577
"testString":
2578-
"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const first = () => { mockedComponent.setState({ activeUsers: 1237 }); return waitForIt(() => mockedComponent.find('h1').text()); }; const second = () => { mockedComponent.setState({ activeUsers: 1000 }); return waitForIt(() => mockedComponent.find('h1').text()); }; const firstValue = await first(); const secondValue = await second(); assert(new RegExp('1237').test(firstValue) && new RegExp('1000').test(secondValue), 'The <code>h1</code> tag should render the <code>activeUsers</code> value from <code>MyComponent</code>&apos;s state.'); }; "
2578+
"async () => { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const first = () => { mockedComponent.setState({ activeUsers: 1237 }); return mockedComponent.find('h1').text(); }; const second = () => { mockedComponent.setState({ activeUsers: 1000 }); return mockedComponent.find('h1').text(); }; assert(new RegExp('1237').test(first()) && new RegExp('1000').test(second()), 'The <code>h1</code> tag should render the <code>activeUsers</code> value from <code>MyComponent</code>&apos;s state.'); }; "
25792579
}
25802580
],
25812581
"solutions": [

0 commit comments

Comments
 (0)