DefinitelyTyped/types/enzyme-async-helpers/enzyme-async-helpers-tests.tsx
Kim Ehrenpohl 889c7c17e8 Add types for enzyme-async-helpers (#30588)
* Add types for enzyme-async-helpers

* Set all config options as optional
2018-11-19 08:28:32 -08:00

28 lines
815 B
TypeScript

import * as React from 'react';
import { mount } from 'enzyme';
import { waitForElement, waitForProps, waitForState, Config } from "enzyme-async-helpers";
const component = mount(<div>component</div>);
const config: Config = {
interval: 50,
timeout: 2000,
timeoutMessage: 'Timed out.',
logStructureOnTimeout: true,
logStructureOnSuccess: false
};
// $ExpectType Promise<void>
waitForElement(component, "selector");
// $ExpectType Promise<void>
waitForElement(component, "selector", config);
// $ExpectType Promise<void>
waitForProps(component, (props) => true);
// $ExpectType Promise<void>
waitForProps(component, (props) => true, config);
// $ExpectType Promise<void>
waitForState(component, (state) => true);
// $ExpectType Promise<void>
waitForState(component, (state) => true, config);