Skip to content

Commit e3ca693

Browse files
committed
itest: sort batch assets before comparison
1 parent d4c06ec commit e3ca693

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

itest/assets_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"context"
66
"crypto/tls"
77
"net/http"
8+
"slices"
9+
"strings"
810
"time"
911

1012
"github.com/btcsuite/btcd/btcec/v2"
@@ -596,5 +598,22 @@ func testMintBatchAndTransfer(t *harnessTest) {
596598

597599
// The batch listed after the transfer should be identical to the batch
598600
// listed before the transfer.
599-
require.True(t.t, proto.Equal(originalBatches, afterBatches))
601+
require.Equal(
602+
t.t, len(originalBatches.Batches), len(afterBatches.Batches),
603+
)
604+
605+
originalBatch := originalBatches.Batches[0].Batch
606+
afterBatch := afterBatches.Batches[0].Batch
607+
608+
// Sort the assets from the listed batch before comparison.
609+
slices.SortFunc(originalBatch.Assets,
610+
func(a, b *mintrpc.PendingAsset) int {
611+
return strings.Compare(a.Name, b.Name)
612+
})
613+
slices.SortFunc(afterBatch.Assets,
614+
func(a, b *mintrpc.PendingAsset) int {
615+
return strings.Compare(a.Name, b.Name)
616+
})
617+
618+
require.True(t.t, proto.Equal(originalBatch, afterBatch))
600619
}

0 commit comments

Comments
 (0)