From 3f18bf73b521f5a6d8180e577b9877bac41bc5ed Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Mon, 15 Nov 2021 02:10:51 +0500 Subject: [PATCH] :label: Added TestConfig domain --- internal/domain/config.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 internal/domain/config.go diff --git a/internal/domain/config.go b/internal/domain/config.go new file mode 100644 index 0000000..e3d30c0 --- /dev/null +++ b/internal/domain/config.go @@ -0,0 +1,23 @@ +package domain + +import ( + "testing" + + "github.com/spf13/viper" +) + +// TODO(toby3d): create Config domain + +// TestConfig returns a valid *viper.Viper with the generated test data filled in. +func TestConfig(tb testing.TB) *viper.Viper { + tb.Helper() + + v := viper.New() + v.Set("indieauth.jwtSecret", "hackme") + v.Set("indieauth.jwtSigningAlgorithm", "HS256") + v.Set("server.domain", "example.com") + v.Set("server.protocol", "https") + v.Set("server.rootUrl", "{{protocol}}://{{domain}}/") + + return v +}