({ initialValue })
| 20 | */ |
| 21 | function validateHook(name, hook) { |
| 22 | const TestComponent = ({ initialValue }) => { |
| 23 | const [value, setValue] = useState(initialValue); |
| 24 | hook(value); |
| 25 | |
| 26 | return ( |
| 27 | <button type="button" onClick={() => setValue(NaN)}> |
| 28 | Set to NaN |
| 29 | </button> |
| 30 | ); |
| 31 | }; |
| 32 | |
| 33 | it(`should error if ${name} is mounted with NaN as an argument`, async () => { |
| 34 | render(<TestComponent initialValue={NaN} />, scratch); |