UNPKG

reblend-testing-library

Version:

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

33 lines (32 loc) 771 B
"use strict"; var _reblendjs = require("reblendjs"); var _ = require("../"); test("render errors", async () => { //@reblendComponent class Thrower extends _reblendjs.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 _reblendjs.Reblend { handleError(error) { errorMessage = error.message; } } await (0, _.render)(_reblendjs.Reblend.construct.bind(this)(Thrower, null), { wrapper: ErrorBoundary }); expect(errorMessage).toBe("Boom!"); });