Skip to content

Commit

Permalink
Refactoring test logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
madflojo committed Nov 5, 2023
1 parent 64c8686 commit 346ce17
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions functions/src/handler/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ func TestDecodeFields(t *testing.T) {
for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
result, err := decodeData(tc.input)
if err != nil && !tc.err {
t.Errorf("Expected no error, got %v", err)
if err != nil {
if !tc.err {
t.Errorf("Expected no error, got %v", err)
}
return
}
if err == nil && tc.err {
t.Errorf("Expected error, got none")
t.Fatalf("Expected error, got none")
}

for k, v := range tc.expected {
Expand Down

0 comments on commit 346ce17

Please sign in to comment.