test(import): read the note's text without a tag-stripping replace

This commit is contained in:
Marc-André Bombeck committed 2026-10-04 16:14:47 +02:00
1 parent bc0d9f915f
commit dc9b0e3936
1 file changed
+12 -7
@@ -24,13 +24,18 @@ function bundle(locale: Locale): MessageBundle {
}
function render(locale: Locale, count: number): string {
return renderToStaticMarkup(
<I18nProvider initialLocale={locale} initialMessages={bundle(locale)}>
<AppleHealthOwnRecordsNote count={count} />
</I18nProvider>,
)
.replace(/<[^>]+>/g, "")
.trim();
return (
renderToStaticMarkup(
<I18nProvider initialLocale={locale} initialMessages={bundle(locale)}>
<AppleHealthOwnRecordsNote count={count} />
</I18nProvider>,
)
// Text between the tags; a test reading its own static markup, not a
// sanitiser for untrusted input.
.split(/<[^>]*>/)
.join("")
.trim()
);
}
describe("<AppleHealthOwnRecordsNote>", () => {