Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dhfherna committed Oct 30, 2023
1 parent ce47ab8 commit 858d4fe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions realistic_word_test.go
Expand Up @@ -9,7 +9,6 @@ func TestGetWord(t *testing.T) {
context string
mockFunc func()
expectWords []string
expectWord string
}{
{
context: "test",
Expand All @@ -23,7 +22,6 @@ func TestGetWord(t *testing.T) {
}
},
expectWords: []string{"test1", "test2", "test3"},
expectWord: "test1",
},
}

Expand All @@ -35,8 +33,15 @@ func TestGetWord(t *testing.T) {
t.Errorf("getWords(%s) was incorrect, got: %d, want: %d.", table.context, len(resultWords), len(table.expectWords))
}
resultWord := getWord(table.context)
if resultWord != table.expectWord {
t.Errorf("getWord(%s) was incorrect, got: %s, want: %s.", table.context, resultWord, table.expectWord)
valid := false
for _, w := range table.expectWords {
if w == resultWord {
valid = true
break
}
}
if !valid {
t.Errorf("getWord(%s) was incorrect, got: %s.", table.context, resultWord)
}
consultService = originalResponse
}
Expand Down

0 comments on commit 858d4fe

Please sign in to comment.