Skip to content

Commit

Permalink
Add tests for IsValidString
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWiegman committed Jun 4, 2024
1 parent 7262375 commit 95b1175
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/helpers/helpers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package helpers

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsValidString(t *testing.T) {
var testCases = []struct {
name string
checkString string
validStrings []string
shouldPass bool
}{
{
name: "Ensure a valid string is valid",
checkString: "test",
validStrings: []string{"test", "test2"},
shouldPass: true},
{
name: "Ensure an invalid string is not valid",
checkString: "test",
validStrings: []string{"test2", "test3"},
shouldPass: false},
}

for _, test := range testCases {
result := IsValidString(test.checkString, test.validStrings)

assert.Equal(t, test.shouldPass, result, test.name)
}
}

0 comments on commit 95b1175

Please sign in to comment.