Skip to content

Commit

Permalink
feat: core_test.go implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
nezutero committed Oct 21, 2023
1 parent aa49fd5 commit 74c41aa
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/core_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package tests

import (
"testing"
"github.com/kenjitheman/url-probe/core"
)

func TestRun(t *testing.T) {
tests := []struct {
name string
args []string
expectErr bool
}{
{
name: "Valid URLs",
args: []string{"https://www.github.com", "https://www.google.com"},
expectErr: false,
},
{
name: "No URLs Provided",
args: []string{},
expectErr: true,
},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
err := core.Run(test.args)
if test.expectErr && err == nil {
t.Errorf("expected an error but got none")
} else if !test.expectErr && err != nil {
t.Errorf("expected no error but got: %v", err)
}
})
}
}

0 comments on commit 74c41aa

Please sign in to comment.