Skip to content

Commit

Permalink
improve UT
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Apr 2, 2024
1 parent 1d136f1 commit f6eddc2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions x/ccv/provider/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func TestQueryOldestUnconfirmedVsc(t *testing.T) {
pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t))
defer ctrl.Finish()

var vscID uint64 = 1
now := time.Now().UTC()
pk.SetVscSendTimestamp(ctx, chainID, vscID, now)
pk.SetVscSendTimestamp(ctx, chainID, 2, now)
pk.SetVscSendTimestamp(ctx, chainID, 1, now)
pk.SetConsumerClientId(ctx, chainID, "client-1")

// Request is nil
Expand All @@ -83,7 +83,17 @@ func TestQueryOldestUnconfirmedVsc(t *testing.T) {
response, err := pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID})
require.NoError(t, err)
expectedResult := types.VscSendTimestamp{
VscId: vscID,
VscId: 1,
Timestamp: now,
}
require.Equal(t, expectedResult, response.VscSendTimestamp)

// Make sure that the oldest is queried
pk.DeleteVscSendTimestamp(ctx, chainID, 1)
response, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID})
require.NoError(t, err)
expectedResult = types.VscSendTimestamp{
VscId: 2,
Timestamp: now,
}
require.Equal(t, expectedResult, response.VscSendTimestamp)
Expand Down

0 comments on commit f6eddc2

Please sign in to comment.