From 982d9513e71b3d48e20cfa38454a0e1215a8d963 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?=
Date: Sun, 28 Jan 2024 22:11:05 +0100
Subject: testing: Simplify some integration tests
---
.../codeblocks/codeblocks_integration_test.go | 46 ++---------
markup/goldmark/goldmark_integration_test.go | 89 +++-------------------
markup/goldmark/images/images_integration_test.go | 32 +-------
markup/highlight/highlight_integration_test.go | 16 +---
4 files changed, 23 insertions(+), 160 deletions(-)
(limited to 'markup')
diff --git a/markup/goldmark/codeblocks/codeblocks_integration_test.go b/markup/goldmark/codeblocks/codeblocks_integration_test.go
index 5597fc507..8ed691302 100644
--- a/markup/goldmark/codeblocks/codeblocks_integration_test.go
+++ b/markup/goldmark/codeblocks/codeblocks_integration_test.go
@@ -87,13 +87,7 @@ echo "l8";
§§§
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html", `
Goat SVG:
",
@@ -70,13 +64,7 @@ This is an inline image: ![Inline Image](/inline.jpg). Some more text.
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html",
"This is an inline image: \n\t
\n. Some more text.",
@@ -86,26 +74,14 @@ This is an inline image: ![Inline Image](/inline.jpg). Some more text.
t.Run("No Hook, no wrap", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "CONFIG_VALUE", "false")
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html", "This is an inline image:
. Some more text.
\n
")
})
t.Run("No Hook, wrap", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "CONFIG_VALUE", "true")
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html", "![\"Block](\"/block.jpg\")
")
})
diff --git a/markup/highlight/highlight_integration_test.go b/markup/highlight/highlight_integration_test.go
index b53b585c0..d36bc820a 100644
--- a/markup/highlight/highlight_integration_test.go
+++ b/markup/highlight/highlight_integration_test.go
@@ -67,13 +67,7 @@ HighlightCodeBlock: Wrapped:{{ $result.Wrapped }}|Inner:{{ $result.Inner }}
{{ .Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html",
"Inline:(message "this highlight shortcode")
:End.",
@@ -103,13 +97,7 @@ xəx := 0
{{ .Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: false,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", `
xəx
--
cgit v1.2.3