diff --git a/internal/env/env_test.go b/internal/env/env_test.go index 7f8584c..4499588 100644 --- a/internal/env/env_test.go +++ b/internal/env/env_test.go @@ -54,47 +54,3 @@ func TestTimeZoneParser(t *testing.T) { _, err = Parse() assert.Equal(t, err.Error(), "Key: 'Config.TimeZone' Error:Field validation for 'TimeZone' failed on the 'timezone' tag", "Validation should fail") } - -func TestHealthcheckUrlParser(t *testing.T) { - key := "HEALTHCHECK_URL" - var err error - defer func() { - os.Unsetenv(key) - }() - - os.Setenv(key, "https://example.com/") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "http://www.example.com/") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "https://example.com") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.HealthcheckURL' Error:Field validation for 'HealthcheckURL' failed on the 'endswith' tag", "Validation should fail") - - os.Setenv(key, "abc") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.HealthcheckURL' Error:Field validation for 'HealthcheckURL' failed on the 'url' tag", "Validation should fail") -} - -func TestShoutrrrParser(t *testing.T) { - key := "NOTIFICATION_URL" - var err error - defer func() { - os.Unsetenv(key) - }() - - os.Setenv(key, "smtp://xxx@xxx.com:xxx@smtp.gmail.com:587/?from=xxx@xxx.com&to=xxx@xxx.com") - _, err = Parse() - assert.Equal(t, err, nil, "Parsing should pass") - - os.Setenv(key, "https://example.com") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.NotificationURL' Error:Field validation for 'NotificationURL' failed on the 'shoutrrr' tag", "Validation should fail") - - os.Setenv(key, "abc") - _, err = Parse() - assert.Equal(t, err.Error(), "Key: 'Config.NotificationURL' Error:Field validation for 'NotificationURL' failed on the 'shoutrrr' tag", "Validation should fail") -}