Skip to content

Commit 4ca3b76

Browse files
committed
test: clean up wanterr logic to be more readable as an assert
Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
1 parent ad4b492 commit 4ca3b76

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/emlb/emlb_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,12 @@ func Test_getExternalIPv4Target(t *testing.T) {
167167
t.Run(tt.name, func(t *testing.T) {
168168
g := NewWithT(t)
169169
got, err := getExternalIPv4Target(tt.args.deviceAddr)
170-
if (err != nil) != tt.wantErr {
171-
g.Expect(err).To(Equal(tt.wantErr))
172-
return
170+
if tt.wantErr {
171+
g.Expect(err).To(HaveOccurred())
172+
} else {
173+
g.Expect(err).ToNot(HaveOccurred())
174+
g.Expect(got).To(Equal(tt.want))
173175
}
174-
g.Expect(got).To(Equal(tt.want))
175176
})
176177
}
177178
}

0 commit comments

Comments
 (0)