From b2a98a90766529b475c9915a3e8fd96241d944a3 Mon Sep 17 00:00:00 2001 From: ffranr Date: Wed, 10 Jan 2024 16:06:29 +0000 Subject: [PATCH] multi: make use of `require.Len` where possible This commit changes instances of `require.Equal(t, , len())` to `require.Len(t, , )` where possible. --- itest/assertions.go | 4 ++-- tapdb/assets_store_test.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/itest/assertions.go b/itest/assertions.go index 4856100ae..f86f46673 100644 --- a/itest/assertions.go +++ b/itest/assertions.go @@ -1567,10 +1567,10 @@ func assertGroups(t *testing.T, client taprpc.TaprootAssetsClient, require.NoError(t, err) groupKeys := maps.Keys(assetGroups.Groups) - require.Equal(t, 2, len(groupKeys)) + require.Len(t, groupKeys, 2) groupedAssets := assetGroups.Groups[groupKeys[0]].Assets - require.Equal(t, 1, len(groupedAssets)) + require.Len(t, groupedAssets, 1) require.Equal(t, 1, len(assetGroups.Groups[groupKeys[1]].Assets)) groupedAssets = append( diff --git a/tapdb/assets_store_test.go b/tapdb/assets_store_test.go index 5e5da6220..fad398b1a 100644 --- a/tapdb/assets_store_test.go +++ b/tapdb/assets_store_test.go @@ -1261,7 +1261,7 @@ func TestAssetExportLog(t *testing.T) { // looking for all unconfirmed transfers. assetTransfers, err := db.QueryAssetTransfers(ctx, TransferQuery{}) require.NoError(t, err) - require.Equal(t, 1, len(assetTransfers)) + require.Len(t, assetTransfers, 1) // We should also be able to find it based on its outpoint. firstOutput := spendDelta.Outputs[0] @@ -1270,7 +1270,7 @@ func TestAssetExportLog(t *testing.T) { AnchorTxHash: firstOutputAnchor.OutPoint.Hash[:], }) require.NoError(t, err) - require.Equal(t, 1, len(assetTransfers)) + require.Len(t, assetTransfers, 1) // Check that the new UTXO is found among our managed UTXOs. utxos, err = assetsStore.FetchManagedUTXOs(ctx) @@ -1302,13 +1302,13 @@ func TestAssetExportLog(t *testing.T) { UnconfOnly: true, }) require.NoError(t, err) - require.Equal(t, 1, len(assetTransfers)) + require.Len(t, assetTransfers, 1) // This should also show up in the set of pending parcels. It should // also match exactly the inbound parcel we used to make the delta. parcels, err := assetsStore.PendingParcels(ctx) require.NoError(t, err) - require.Equal(t, 1, len(parcels)) + require.Len(t, parcels, 1) require.Equal(t, spendDelta, parcels[0]) // We should also be able to query for the parcel when filtering on its @@ -1428,7 +1428,7 @@ func TestAssetExportLog(t *testing.T) { // At this point, there should be no more pending parcels. parcels, err = assetsStore.PendingParcels(ctx) require.NoError(t, err) - require.Equal(t, 0, len(parcels)) + require.Len(t, parcels, 0) } // TestAssetGroupWitnessUpsert tests that if you try to insert another asset