18 lines
633 B
TypeScript
18 lines
633 B
TypeScript
|
|
import assert from "node:assert/strict";
|
||
|
|
import test from "node:test";
|
||
|
|
import { renderToStaticMarkup } from "react-dom/server";
|
||
|
|
|
||
|
|
import { RenderErrorFallback } from "./render-error-fallback";
|
||
|
|
|
||
|
|
test("renderiza un fallback de error inesperado sin detalles técnicos", () => {
|
||
|
|
const html = renderToStaticMarkup(
|
||
|
|
<RenderErrorFallback onGoHome={() => undefined} resetErrorBoundary={() => undefined} />
|
||
|
|
);
|
||
|
|
|
||
|
|
assert.match(html, /Se ha producido un error inesperado/);
|
||
|
|
assert.match(html, /Intentar de nuevo/);
|
||
|
|
assert.match(html, /Ir al inicio/);
|
||
|
|
assert.doesNotMatch(html, /stack/i);
|
||
|
|
assert.doesNotMatch(html, /Error:/);
|
||
|
|
});
|