diff --git a/codecov.yml b/codecov.yml index e748a6a..318fcae 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,5 +2,5 @@ coverage: status: project: default: - target: 75% + target: 70% threshold: 10% diff --git a/gencerts_test.go b/gencerts_test.go index 0dc187f..90a1e50 100644 --- a/gencerts_test.go +++ b/gencerts_test.go @@ -7,10 +7,38 @@ import ( ) func TestGeneratingCerts(t *testing.T) { - _, _, err := GenerateCerts() - if err != nil { - t.Errorf("Error while generating certificates - %s", err) - } + t.Run("No Domain", func(t *testing.T) { + cert, key, err := GenerateCerts() + if err != nil { + t.Errorf("Error while generating certificates - %s", err) + } + + if len(cert) == 0 || len(key) == 0 { + t.Errorf("Cert %d or Key %d is empty", len(cert), len(key)) + } + }) + + t.Run("With Domain", func(t *testing.T) { + cert, key, err := GenerateCerts("example.com") + if err != nil { + t.Errorf("Error while generating certificates - %s", err) + } + + if len(cert) == 0 || len(key) == 0 { + t.Errorf("Cert %d or Key %d is empty", len(cert), len(key)) + } + }) + + t.Run("With Many Domains", func(t *testing.T) { + cert, key, err := GenerateCerts("example.com", "example.org", "example.net") + if err != nil { + t.Errorf("Error while generating certificates - %s", err) + } + + if len(cert) == 0 || len(key) == 0 { + t.Errorf("Cert %d or Key %d is empty", len(cert), len(key)) + } + }) } func TestGeneratingCertsToFile(t *testing.T) {