Skip to content

Commit

Permalink
Use testify
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Dec 10, 2024
1 parent f9c34f6 commit 9f11971
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions internal/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"sort"
"task-runner-launcher/internal/config"
"testing"

"github.com/stretchr/testify/assert"
)

func TestPartitionByAllowlist(t *testing.T) {
Expand Down Expand Up @@ -66,16 +68,16 @@ func TestPartitionByAllowlist(t *testing.T) {

included, excluded := partitionByAllowlist(tt.allowList)

if tt.expectedInclude == nil && len(included) == 0 {
// ok
} else if !reflect.DeepEqual(included, tt.expectedInclude) {
t.Errorf("partitionByAllowlist() included = %v, want %v", included, tt.expectedInclude)
if tt.expectedInclude == nil {
assert.Empty(t, included)
} else {
assert.Equal(t, tt.expectedInclude, included)
}

if tt.expectedExclude == nil && len(excluded) == 0 {
// ok
} else if !reflect.DeepEqual(excluded, tt.expectedExclude) {
t.Errorf("partitionByAllowlist() excluded = %v, want %v", excluded, tt.expectedExclude)
if tt.expectedExclude == nil {
assert.Empty(t, excluded)
} else {
assert.Equal(t, tt.expectedExclude, excluded)
}
})
}
Expand Down

0 comments on commit 9f11971

Please sign in to comment.