Skip to content

Commit

Permalink
Update disclaimer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinewi committed Dec 17, 2024
1 parent 2a98bbe commit f74f831
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ class ContentValidatorTest extends UnitSuite with TestEnvironment {
content = Seq(ArticleContent(validDocument, "nb")),
disclaimer = Some(Seq(Disclaimer("<p><hallo>hei</hallo></p>", "nb")))
)
val result = contentValidator.validateArticle(article, false)
result.failed.get.asInstanceOf[ValidationException].errors.length should be(1)
result.failed.get.asInstanceOf[ValidationException].errors.head.message should be(
"The content contains illegal tags and/or attributes. Allowed HTML tags are: h3, msgroup, a, article, sub, sup, mtext, msrow, tbody, mtd, pre, thead, figcaption, mover, msup, semantics, ol, span, mroot, munder, h4, mscarries, dt, nav, mtr, ndlaembed, li, br, mrow, merror, mphantom, u, audio, ul, maligngroup, mfenced, annotation, div, strong, section, i, mspace, malignmark, mfrac, code, h2, td, aside, em, mstack, button, dl, th, tfoot, math, tr, b, blockquote, msline, col, annotation-xml, mstyle, caption, mpadded, mo, mlongdiv, msubsup, p, munderover, maction, menclose, h1, details, mmultiscripts, msqrt, mscarry, mstac, mi, mglyph, mlabeledtr, mtable, mprescripts, summary, mn, msub, ms, table, colgroup, dd"

val Failure(error: ValidationException) = contentValidator.validateArticle(article, false)
error should be(
ValidationException(
"disclaimer.nb",
"The content contains illegal tags and/or attributes. Allowed HTML tags are: h3, msgroup, a, article, sub, sup, mtext, msrow, tbody, mtd, pre, thead, figcaption, mover, msup, semantics, ol, span, mroot, munder, h4, mscarries, dt, nav, mtr, ndlaembed, li, br, mrow, merror, mphantom, u, audio, ul, maligngroup, mfenced, annotation, div, strong, section, i, mspace, malignmark, mfrac, code, h2, td, aside, em, mstack, button, dl, th, tfoot, math, tr, b, blockquote, msline, col, annotation-xml, mstyle, caption, mpadded, mo, mlongdiv, msubsup, p, munderover, maction, menclose, h1, details, mmultiscripts, msqrt, mscarry, mstac, mi, mglyph, mlabeledtr, mtable, mprescripts, summary, mn, msub, ms, table, colgroup, dd"
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ class ContentValidatorTest extends UnitSuite with TestEnvironment {
content = Seq(ArticleContent(validDocument, "nb")),
disclaimer = Some(Seq(Disclaimer("<p><hallo>hei</hallo></p>", "nb")))
)
val result = contentValidator.validateArticle(article)
result.failed.get.asInstanceOf[ValidationException].errors.length should be(1)
result.failed.get.asInstanceOf[ValidationException].errors.head.message should be(
"The content contains illegal tags and/or attributes. Allowed HTML tags are: h3, msgroup, a, article, sub, sup, mtext, msrow, tbody, mtd, pre, thead, figcaption, mover, msup, semantics, ol, span, mroot, munder, h4, mscarries, dt, nav, mtr, ndlaembed, li, br, mrow, merror, mphantom, u, audio, ul, maligngroup, mfenced, annotation, div, strong, section, i, mspace, malignmark, mfrac, code, h2, td, aside, em, mstack, button, dl, th, tfoot, math, tr, b, blockquote, msline, col, annotation-xml, mstyle, caption, mpadded, mo, mlongdiv, msubsup, p, munderover, maction, menclose, h1, details, mmultiscripts, msqrt, mscarry, mstac, mi, mglyph, mlabeledtr, mtable, mprescripts, summary, mn, msub, ms, table, colgroup, dd"
val Failure(error: ValidationException) = contentValidator.validateArticle(article)
error should be(
ValidationException(
"disclaimer",
"The content contains illegal tags and/or attributes. Allowed HTML tags are: h3, msgroup, a, article, sub, sup, mtext, msrow, tbody, mtd, pre, thead, figcaption, mover, msup, semantics, ol, span, mroot, munder, h4, mscarries, dt, nav, mtr, ndlaembed, li, br, mrow, merror, mphantom, u, audio, ul, maligngroup, mfenced, annotation, div, strong, section, i, mspace, malignmark, mfrac, code, h2, td, aside, em, mstack, button, dl, th, tfoot, math, tr, b, blockquote, msline, col, annotation-xml, mstyle, caption, mpadded, mo, mlongdiv, msubsup, p, munderover, maction, menclose, h1, details, mmultiscripts, msqrt, mscarry, mstac, mi, mglyph, mlabeledtr, mtable, mprescripts, summary, mn, msub, ms, table, colgroup, dd"
)
)
}

Expand Down

0 comments on commit f74f831

Please sign in to comment.