Update tests to prefer RTL over Enzyme (#10247
* Update tests to prefer RTL over Enzyme * Strict types
This commit is contained in:
parent
dd6fc124d7
commit
f40d15388c
20 changed files with 1095 additions and 632 deletions
|
@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line deprecate/import
|
||||
import { ReactWrapper } from "enzyme";
|
||||
import EventEmitter from "events";
|
||||
|
||||
import { ActionPayload } from "../../src/dispatcher/payloads";
|
||||
|
@ -128,17 +126,6 @@ export function untilEmission(
|
|||
});
|
||||
}
|
||||
|
||||
export const findByAttr = (attr: string) => (component: ReactWrapper, value: string) =>
|
||||
component.find(`[${attr}="${value}"]`);
|
||||
export const findByTestId = findByAttr("data-test-id");
|
||||
export const findById = findByAttr("id");
|
||||
export const findByAriaLabel = findByAttr("aria-label");
|
||||
|
||||
const findByTagAndAttr = (attr: string) => (component: ReactWrapper, value: string, tag: string) =>
|
||||
component.find(`${tag}[${attr}="${value}"]`);
|
||||
|
||||
export const findByTagAndTestId = findByTagAndAttr("data-test-id");
|
||||
|
||||
export const flushPromises = async () => await new Promise((resolve) => window.setTimeout(resolve));
|
||||
|
||||
// with jest's modern fake timers process.nextTick is also mocked,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue