Skip to content

Commit

Permalink
Improve x/ tests with require (ava-labs#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu committed Jun 15, 2023
1 parent 764c456 commit 689aec6
Show file tree
Hide file tree
Showing 12 changed files with 836 additions and 716 deletions.
3 changes: 1 addition & 2 deletions api/health/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ func awaitHealthy(t *testing.T, r Reporter, healthy bool) {
}

func awaitLiveness(t *testing.T, r Reporter, liveness bool) {
require := require.New(t)
require.Eventually(func() bool {
require.Eventually(t, func() bool {
_, ok := r.Liveness()
return ok == liveness
}, awaitTimeout, awaitFreq)
Expand Down
3 changes: 1 addition & 2 deletions genesis/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ func TestAllocationLess(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require := require.New(t)
require.Equal(tt.expected, tt.alloc1.Less(tt.alloc2))
require.Equal(t, tt.expected, tt.alloc1.Less(tt.alloc2))
})
}
}
3 changes: 1 addition & 2 deletions utils/sampler/weighted_heap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ func TestWeightedHeapElementLess(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require := require.New(t)
require.Equal(tt.expected, tt.elt1.Less(tt.elt2))
require.Equal(t, tt.expected, tt.elt1.Less(tt.elt2))
})
}
}
3 changes: 1 addition & 2 deletions vms/components/avax/utxo_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ func TestUTXOIDLess(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require := require.New(t)
require.Equal(tt.expected, tt.id1.Less(&tt.id2))
require.Equal(t, tt.expected, tt.id1.Less(&tt.id2))
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions vms/secp256k1fx/keychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ var (
)

func TestNewKeychain(t *testing.T) {
require := require.New(t)
require.NotNil(NewKeychain())
require.NotNil(t, NewKeychain())
}

func TestKeychainGetUnknownAddr(t *testing.T) {
Expand Down

0 comments on commit 689aec6

Please sign in to comment.