Skip to content

Commit 8b4756f

Browse files
committed
supplycommit: export mock functionality for use in supplyverifier
1 parent 0997ca3 commit 8b4756f

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

universe/supplycommit/mock.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ func (m *mockSupplyTreeView) FetchSupplyLeavesByHeight(_ context.Context,
5959
return args.Get(0).(lfn.Result[SupplyLeaves])
6060
}
6161

62-
// mockCommitmentTracker is a mock implementation of the CommitmentTracker
62+
// MockCommitmentTracker is a mock implementation of the CommitmentTracker
6363
// interface.
64-
type mockCommitmentTracker struct {
64+
type MockCommitmentTracker struct {
6565
mock.Mock
6666
}
6767

68-
func (m *mockCommitmentTracker) UnspentPrecommits(ctx context.Context,
68+
func (m *MockCommitmentTracker) UnspentPrecommits(ctx context.Context,
6969
assetSpec asset.Specifier,
7070
localIssuerOnly bool) lfn.Result[PreCommits] {
7171

7272
args := m.Called(ctx, assetSpec, localIssuerOnly)
7373
return args.Get(0).(lfn.Result[PreCommits])
7474
}
7575

76-
func (m *mockCommitmentTracker) SupplyCommit(ctx context.Context,
76+
func (m *MockCommitmentTracker) SupplyCommit(ctx context.Context,
7777
assetSpec asset.Specifier) RootCommitResp {
7878

7979
args := m.Called(ctx, assetSpec)
@@ -432,12 +432,12 @@ func (c *mockIgnoreCheckerCache) InvalidateCache(groupKey btcec.PublicKey) {
432432
c.Called(groupKey)
433433
}
434434

435-
// mockAssetLookup is a mock implementation of the AssetLookup interface.
436-
type mockAssetLookup struct {
435+
// MockAssetLookup is a mock implementation of the AssetLookup interface.
436+
type MockAssetLookup struct {
437437
mock.Mock
438438
}
439439

440-
func (m *mockAssetLookup) FetchSupplyCommitAssets(ctx context.Context,
440+
func (m *MockAssetLookup) FetchSupplyCommitAssets(ctx context.Context,
441441
localControlled bool) ([]btcec.PublicKey, error) {
442442

443443
args := m.Called(ctx, localControlled)
@@ -447,7 +447,7 @@ func (m *mockAssetLookup) FetchSupplyCommitAssets(ctx context.Context,
447447
return args.Get(0).([]btcec.PublicKey), args.Error(1)
448448
}
449449

450-
func (m *mockAssetLookup) QueryAssetGroupByID(ctx context.Context,
450+
func (m *MockAssetLookup) QueryAssetGroupByID(ctx context.Context,
451451
assetID asset.ID) (*asset.AssetGroup, error) {
452452

453453
args := m.Called(ctx, assetID)
@@ -457,7 +457,7 @@ func (m *mockAssetLookup) QueryAssetGroupByID(ctx context.Context,
457457
return args.Get(0).(*asset.AssetGroup), args.Error(1)
458458
}
459459

460-
func (m *mockAssetLookup) QueryAssetGroupByGroupKey(ctx context.Context,
460+
func (m *MockAssetLookup) QueryAssetGroupByGroupKey(ctx context.Context,
461461
groupKey *btcec.PublicKey) (*asset.AssetGroup, error) {
462462

463463
args := m.Called(ctx, groupKey)
@@ -467,7 +467,7 @@ func (m *mockAssetLookup) QueryAssetGroupByGroupKey(ctx context.Context,
467467
return args.Get(0).(*asset.AssetGroup), args.Error(1)
468468
}
469469

470-
func (m *mockAssetLookup) FetchAssetMetaForAsset(ctx context.Context,
470+
func (m *MockAssetLookup) FetchAssetMetaForAsset(ctx context.Context,
471471
assetID asset.ID) (*proof.MetaReveal, error) {
472472

473473
args := m.Called(ctx, assetID)
@@ -477,7 +477,7 @@ func (m *mockAssetLookup) FetchAssetMetaForAsset(ctx context.Context,
477477
return args.Get(0).(*proof.MetaReveal), args.Error(1)
478478
}
479479

480-
func (m *mockAssetLookup) FetchInternalKeyLocator(ctx context.Context,
480+
func (m *MockAssetLookup) FetchInternalKeyLocator(ctx context.Context,
481481
rawKey *btcec.PublicKey) (keychain.KeyLocator, error) {
482482

483483
args := m.Called(ctx, rawKey)

universe/supplycommit/state_machine_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ type supplyCommitTestHarness struct {
121121
env *Environment
122122

123123
mockTreeView *mockSupplyTreeView
124-
mockCommits *mockCommitmentTracker
124+
mockCommits *MockCommitmentTracker
125125
mockWallet *mockWallet
126126
mockKeyRing *mockKeyRing
127127
mockChain *mockChainBridge
128128
mockStateLog *mockStateMachineStore
129129
mockCache *mockIgnoreCheckerCache
130130
mockDaemon *mockDaemonAdapters
131131
mockErrReporter *mockErrorReporter
132-
mockAssetLookup *mockAssetLookup
132+
MockAssetLookup *MockAssetLookup
133133
mockSupplySyncer *mockSupplySyncer
134134

135135
stateSub protofsm.StateSubscriber[Event, *Environment]
@@ -139,15 +139,15 @@ func newSupplyCommitTestHarness(t *testing.T,
139139
cfg *harnessCfg) *supplyCommitTestHarness {
140140

141141
mTreeView := &mockSupplyTreeView{}
142-
mCommits := &mockCommitmentTracker{}
142+
mCommits := &MockCommitmentTracker{}
143143
mWallet := &mockWallet{}
144144
mKey := &mockKeyRing{}
145145
mChain := &mockChainBridge{}
146146
mStateLog := &mockStateMachineStore{}
147147
mDaemon := newMockDaemonAdapters()
148148
mErrReporter := &mockErrorReporter{}
149149
mCache := &mockIgnoreCheckerCache{}
150-
mAssetLookup := &mockAssetLookup{}
150+
mAssetLookup := &MockAssetLookup{}
151151
mSupplySyncer := &mockSupplySyncer{}
152152

153153
env := &Environment{
@@ -190,7 +190,7 @@ func newSupplyCommitTestHarness(t *testing.T,
190190
mockCache: mCache,
191191
mockDaemon: mDaemon,
192192
mockErrReporter: mErrReporter,
193-
mockAssetLookup: mAssetLookup,
193+
MockAssetLookup: mAssetLookup,
194194
mockSupplySyncer: mSupplySyncer,
195195
}
196196

@@ -552,7 +552,7 @@ func (h *supplyCommitTestHarness) expectAssetLookup() {
552552
},
553553
}
554554

555-
h.mockAssetLookup.On(
555+
h.MockAssetLookup.On(
556556
"QueryAssetGroupByGroupKey", mock.Anything, mock.Anything,
557557
).Return(dummyAssetGroup, nil).Maybe()
558558

@@ -562,7 +562,7 @@ func (h *supplyCommitTestHarness) expectAssetLookup() {
562562
Type: proof.MetaOpaque,
563563
}
564564

565-
h.mockAssetLookup.On(
565+
h.MockAssetLookup.On(
566566
"FetchAssetMetaForAsset", mock.Anything, mock.Anything,
567567
).Return(dummyMetaReveal, nil).Maybe()
568568
}

0 commit comments

Comments
 (0)