diff --git a/go/blog/.gitignore b/go/blog/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/go/blog/.gitignore @@ -0,0 +1 @@ +dist diff --git a/go/blog/function_test.go b/go/blog/function_test.go index c26cd34..cfa76cb 100644 --- a/go/blog/function_test.go +++ b/go/blog/function_test.go @@ -3,16 +3,17 @@ package function import ( "net/http" "net/http/httptest" + "strings" "testing" ) -// TestHandle ensures that Handle executes without error and returns the -// HTTP 200 status code indicating no errors. +// TestHandle verifies that the blog is built and served correctly. +// Requires 'make' to be run first to generate the dist/ directory. func TestHandle(t *testing.T) { var ( f = New() w = httptest.NewRecorder() - req = httptest.NewRequest("GET", "http://example.com/test", nil) + req = httptest.NewRequest("GET", "http://example.com/", nil) res *http.Response ) f.Handle(w, req) @@ -22,4 +23,9 @@ func TestHandle(t *testing.T) { if res.StatusCode != 200 { t.Fatalf("unexpected response code: %v", res.StatusCode) } + + body := w.Body.String() + if !strings.Contains(body, "Functions Go Blog") { + t.Fatalf("response body does not contain blog title, got: %s", body[:200]) + } } diff --git a/go/blog/hugo/go.mod b/go/blog/hugo/go.mod new file mode 100644 index 0000000..a5ed39f --- /dev/null +++ b/go/blog/hugo/go.mod @@ -0,0 +1,5 @@ +module github.com/functions-dev/templates/go/blog/hugo + +go 1.25.7 + +require github.com/gauron99/hugo-theme-minimal-dark v0.0.0-20260324081819-be0e014f9cdb // indirect diff --git a/go/blog/hugo/go.sum b/go/blog/hugo/go.sum new file mode 100644 index 0000000..15c5fdd --- /dev/null +++ b/go/blog/hugo/go.sum @@ -0,0 +1,2 @@ +github.com/gauron99/hugo-theme-minimal-dark v0.0.0-20260324081819-be0e014f9cdb h1:I6iAx1Q8C7gn7NerxqxM/Xea4ZFTk43orUVOmt87x1Q= +github.com/gauron99/hugo-theme-minimal-dark v0.0.0-20260324081819-be0e014f9cdb/go.mod h1:87aJ7j4j88ej45sl/8GRgeozGBS4PvKx6d7hcAK78N0= diff --git a/go/blog/hugo/hugo.toml b/go/blog/hugo/hugo.toml index 4528ec0..1857110 100644 --- a/go/blog/hugo/hugo.toml +++ b/go/blog/hugo/hugo.toml @@ -1,9 +1,12 @@ title = "Functions Go Blog" -theme = "not-much" languageCode = "en-us" baseURL = "https://example.org/" copyright = "Sample custom notice © {year}" +[module] + [[module.imports]] + path = "github.com/gauron99/hugo-theme-minimal-dark" + [markup] [markup.highlight] style = 'dracula'