Skip to content

Commit

Permalink
test(static-html): Make a replace operation less invasive
Browse files Browse the repository at this point in the history
The replacement has been introduced for replacing the report creation
timestamp only. However, `replace()` replaces all matches and the
pattern would all so match the timestamp value of issues. So, replace
only the first match, so that issues (with timestamps) can be added in a
following change.

[1]: ba0e4cb

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Apr 25, 2024
1 parent ac009c5 commit 02b4129
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class StaticHtmlReporterFunTest : WordSpec({
"successfully export to a static HTML page" {
val timeStampPattern = Regex("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z")
val ortResult = readOrtResult("src/funTest/assets/reporter-test-input.yml")
val actualReport = generateReport(ortResult).replace(timeStampPattern, "<REPLACE_TIMESTAMP>")
val actualReport = generateReport(ortResult).replaceFirst(timeStampPattern, "<REPLACE_TIMESTAMP>")

val expectedReport = matchExpectedResult(
getAssetFile("static-html-reporter-test-expected-output.html"),
Expand Down

0 comments on commit 02b4129

Please sign in to comment.