You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FLEcli/cmd/wwff_test.go

44 lines
897 B

package cmd
import "testing"
func TestValidateWwff(t *testing.T) {
type args struct {
inputStr string
}
tests := []struct {
name string
args args
wantRef string
wantErrorMsg string
}{
{
"Good call (simple)",
args{ inputStr: "onff-0258", },
"ONFF-0258", "",
},
{
"Good call (simple)",
args{ inputStr: "fff-0258", },
"FFF-0258", "",
},
{
"Good call (simple)",
args{ inputStr: "4xff-0258", },
"4XFF-0258", "",
},
//TODO: add the invalid cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotRef, gotErrorMsg := ValidateWwff(tt.args.inputStr)
if gotRef != tt.wantRef {
t.Errorf("ValidateWwff() gotRef = %v, want %v", gotRef, tt.wantRef)
}
if gotErrorMsg != tt.wantErrorMsg {
t.Errorf("ValidateWwff() gotErrorMsg = %v, want %v", gotErrorMsg, tt.wantErrorMsg)
}
})
}
}