diff --git a/config/validate_test.go b/config/validate_test.go index 9a70f63..a4d8563 100644 --- a/config/validate_test.go +++ b/config/validate_test.go @@ -1,6 +1,7 @@ package config_test import ( + "github.com/stretchr/testify/require" "testing" "github.com/kava-labs/kava-proxy-service/config" @@ -100,3 +101,27 @@ func TestUnitTestValidateConfigReturnsErrorIfInvalidMetricPartitioningPrefillPer assert.NotNil(t, err) } + +func TestUnitTestValidHostnameToHeaderValueMap(t *testing.T) { + testConfig := defaultConfig + testConfig.HostnameToAccessControlAllowOriginValueMapRaw = "localhost:7777>*,evm.kava.io>*" + + err := config.Validate(testConfig) + require.NoError(t, err) +} + +func TestUnitTestEmptyHostnameToHeaderValueMap(t *testing.T) { + testConfig := defaultConfig + testConfig.HostnameToAccessControlAllowOriginValueMapRaw = "" + + err := config.Validate(testConfig) + require.NoError(t, err) +} + +func TestUnitTestInvalidHostnameToHeaderValueMap(t *testing.T) { + testConfig := defaultConfig + testConfig.HostnameToAccessControlAllowOriginValueMapRaw = "invalidmap" + + err := config.Validate(testConfig) + require.Error(t, err) +}