mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
multi: move StoreMock to loopdb
This commit is contained in:
parent
99608ad515
commit
e0d85958f7
8 changed files with 402 additions and 375 deletions
|
|
@ -36,7 +36,7 @@ type testContext struct {
|
|||
serverMock *serverMock
|
||||
swapClient *Client
|
||||
statusChan chan SwapInfo
|
||||
store *storeMock
|
||||
store *loopdb.StoreMock
|
||||
expiryChan chan time.Time
|
||||
runErr chan error
|
||||
stop func()
|
||||
|
|
@ -83,15 +83,15 @@ func createClientTestContext(t *testing.T,
|
|||
clientLnd := test.NewMockLnd()
|
||||
serverMock := newServerMock(clientLnd)
|
||||
|
||||
store := newStoreMock(t)
|
||||
store := loopdb.NewStoreMock(t)
|
||||
for _, s := range pendingSwaps {
|
||||
store.loopOutSwaps[s.Hash] = s.Contract
|
||||
store.LoopOutSwaps[s.Hash] = s.Contract
|
||||
|
||||
updates := []loopdb.SwapStateData{}
|
||||
for _, e := range s.Events {
|
||||
updates = append(updates, e.SwapStateData)
|
||||
}
|
||||
store.loopOutUpdates[s.Hash] = updates
|
||||
store.LoopOutUpdates[s.Hash] = updates
|
||||
}
|
||||
|
||||
expiryChan := make(chan time.Time)
|
||||
|
|
@ -147,7 +147,7 @@ func (ctx *testContext) finish() {
|
|||
}
|
||||
func (ctx *testContext) assertIsDone() {
|
||||
require.NoError(ctx.Context.T, ctx.Context.Lnd.IsDone())
|
||||
require.NoError(ctx.Context.T, ctx.store.isDone())
|
||||
require.NoError(ctx.Context.T, ctx.store.IsDone())
|
||||
|
||||
select {
|
||||
case <-ctx.statusChan:
|
||||
|
|
@ -159,19 +159,19 @@ func (ctx *testContext) assertIsDone() {
|
|||
func (ctx *testContext) assertStored() {
|
||||
ctx.Context.T.Helper()
|
||||
|
||||
ctx.store.assertLoopOutStored()
|
||||
ctx.store.AssertLoopOutStored()
|
||||
}
|
||||
|
||||
func (ctx *testContext) assertStorePreimageReveal() {
|
||||
ctx.Context.T.Helper()
|
||||
|
||||
ctx.store.assertStorePreimageReveal()
|
||||
ctx.store.AssertStorePreimageReveal()
|
||||
}
|
||||
|
||||
func (ctx *testContext) assertStoreFinished(expectedResult loopdb.SwapState) {
|
||||
ctx.Context.T.Helper()
|
||||
|
||||
ctx.store.assertStoreFinished(expectedResult)
|
||||
ctx.store.AssertStoreFinished(expectedResult)
|
||||
}
|
||||
|
||||
func (ctx *testContext) assertStatus(expectedState loopdb.SwapState) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue