Skip to content

Commit

Permalink
Merge pull request #13 from madflojo/cov2
Browse files Browse the repository at this point in the history
Improving code coverage
  • Loading branch information
madflojo authored May 19, 2024
2 parents d6cbade + 6284b07 commit ab52eab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ coverage:
status:
project:
default:
target: 75%
target: 70%
threshold: 10%
36 changes: 32 additions & 4 deletions gencerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ab52eab

Please sign in to comment.