🏷️ Added TestConfig domain

This commit is contained in:
Maxim Lebedev 2021-11-15 02:10:51 +05:00
parent b8ba8dd392
commit 3f18bf73b5
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 23 additions and 0 deletions

23
internal/domain/config.go Normal file
View File

@ -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
}