Skip to content

Commit ea765c8

Browse files
author
Matthew Fisher
committed
fix(tests): lower cyclomatic complexity of Checklist
It was a little confusing to read the different cases, so I lowered the complexity in order to read through the code for future readers.
1 parent 6328afe commit ea765c8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

tests/utils/itutils.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ func CheckList(
196196
if err != nil {
197197
t.Fatal(err)
198198
}
199-
if strings.Contains(stdout.String(), contain) == notflag {
200-
if notflag {
201-
t.Fatalf(
202-
"Didn't expect '%s' in command output:\n%v", contain, stdout)
203-
}
199+
if notflag && strings.Contains(stdout.String(), contain) {
200+
t.Fatalf("Didn't expect '%s' in command output:\n%v", contain, stdout)
201+
}
202+
if !notflag && !strings.Contains(stdout.String(), contain) {
204203
t.Fatalf("Expected '%s' in command output:\n%v", contain, stdout)
205204
}
206205
}

0 commit comments

Comments
 (0)