UNPKG

reblend-testing-library

Version:

Simple and complete Reblendjs testing utilities that encourage good testing practices.

31 lines 720 B
import { Reblend } from "reblendjs"; import { render } from "../"; test("render errors", async () => { //@reblendComponent class Thrower extends Reblend { static ELEMENT_NAME = "Thrower"; constructor() { super(); } async initState() { throw new Error("Boom!"); } async initProps() { this.props = {}; } async html() { return; } } /* @Reblend: Transformed from function to class */ let errorMessage = ""; class ErrorBoundary extends Reblend { handleError(error) { errorMessage = error.message; } } await render(Reblend.construct.bind(this)(Thrower, null), { wrapper: ErrorBoundary }); expect(errorMessage).toBe("Boom!"); });