Skip to content

Commit

Permalink
test: clean up wanterr logic to be more readable as an assert
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Privitere <[email protected]>
  • Loading branch information
cprivitere committed May 24, 2024
1 parent ad4b492 commit 4ca3b76
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/emlb/emlb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ func Test_getExternalIPv4Target(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
got, err := getExternalIPv4Target(tt.args.deviceAddr)
if (err != nil) != tt.wantErr {
g.Expect(err).To(Equal(tt.wantErr))
return
if tt.wantErr {
g.Expect(err).To(HaveOccurred())
} else {
g.Expect(err).ToNot(HaveOccurred())
g.Expect(got).To(Equal(tt.want))
}
g.Expect(got).To(Equal(tt.want))
})
}
}
Expand Down

0 comments on commit 4ca3b76

Please sign in to comment.