mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
test(import): read the note's text without a tag-stripping replace
This commit is contained in:
1 parent
bc0d9f915f
commit
dc9b0e3936
1 file changed
+12
-7
+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>", () => {
|
||||
|
||||
Reference in new issue
Block a user