mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(curriculum): make step 3 state tests order-agnostic (#65516)
This commit is contained in:
parent
42beead4f7
commit
49a1e72e05
@ -38,7 +38,8 @@ Your `useState` hook for `powerSource` should have an initial value of empty str
|
||||
const _a = eval(script);
|
||||
const _b = await __helpers.prepTestComponent(exports.SuperheroForm);
|
||||
|
||||
assert.strictEqual(abuseState.calls[2]?.[0], "");
|
||||
const newStateCalls = abuseState.calls.slice(2);
|
||||
assert.isTrue(newStateCalls.some(call => call[0] === ""));
|
||||
```
|
||||
|
||||
You should use array destructuring to set a `powers` state variable and a `setPowers` setter.
|
||||
@ -68,9 +69,8 @@ Your `useState` hook for `powers` should have an initial value of empty array.
|
||||
const _a = eval(script);
|
||||
const _b = await __helpers.prepTestComponent(exports.SuperheroForm);
|
||||
|
||||
console.log("State calls:", abuseState.calls)
|
||||
|
||||
assert.deepEqual(abuseState.calls[3]?.[0], []);
|
||||
const newStateCalls = abuseState.calls.slice(2);
|
||||
assert.isTrue(newStateCalls.some(call => Array.isArray(call[0]) && call[0].length === 0));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user