"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.render = exports.checkForRenderErrors = void 0;
const tslib_1 = require("tslib");
const react_1 = require("@testing-library/react");
function checkForRenderErrors(errorList) {
    const ignoreErrorStrings = [
        "Warning: Failed prop type: The prop `rows`",
        "Warning: Failed prop type: The prop `rowsMax`",
        "Warning: React does not recognize the `%s` prop on a DOM element",
        "Error: Not implemented: HTMLCanvasElement.prototype.getContext",
        "Failed prop type: Invalid prop `children[1]` of type `array` supplied to `ForwardRef(TabList)`",
        "Warning: Failed %s type: %s%s",
        "Material-UI:",
        "Warning: A component is changing an uncontrolled input of type",
    ];
    expect(errorList.filter((e) => {
        return !ignoreErrorStrings.find((ignoreStr) => (e || "").includes(ignoreStr));
    })).toHaveLength(0);
}
exports.checkForRenderErrors = checkForRenderErrors;
const customRender = (ui, options) => {
    let errorList = [];
    const renderError = (output) => {
        errorList.push(output);
    };
    const renderWarn = (output) => {
        errorList.push(output);
    };
    const renderLog = (output) => { };
    const originalError = console.error;
    const originalWarn = console.warn;
    const originalLog = console.log;
    console.error = renderError;
    console.warn = renderWarn;
    console.log = renderLog;
    const content = (0, react_1.render)(ui, options);
    console.error = originalError;
    console.warn = originalWarn;
    console.log = originalLog;
    checkForRenderErrors(errorList);
    return content;
};
exports.render = customRender;
// re-export everything
tslib_1.__exportStar(require("@testing-library/react"), exports);
//# sourceMappingURL=test-utils.js.map