-
Notifications
You must be signed in to change notification settings - Fork 69
/
service_test.go
36 lines (33 loc) · 1.11 KB
/
service_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package server
import (
"testing"
"github.com/0xPolygonHermez/zkevm-bridge-service/etherman"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
func TestGetClaimProofbyGER(t *testing.T) {
cfg := Config{
CacheSize: 32,
}
mockStorage := newBridgeServiceStorageMock(t)
sut := NewBridgeService(cfg, 32, []uint32{0, 1}, mockStorage)
var (
depositCnt uint32
networkID uint32
)
GER := common.Hash{}
deposit := ðerman.Deposit{}
mockStorage.EXPECT().GetDeposit(mock.Anything, depositCnt, networkID, mock.Anything).Return(deposit, nil)
exitRoot := etherman.GlobalExitRoot{
ExitRoots: []common.Hash{{}, {}},
}
mockStorage.EXPECT().GetExitRootByGER(mock.Anything, GER, mock.Anything).Return(&exitRoot, nil)
node := [][]byte{{}, {}}
mockStorage.EXPECT().Get(mock.Anything, mock.Anything, mock.Anything).Return(node, nil)
smtProof, smtRollupProof, globaExitRoot, err := sut.GetClaimProofbyGER(depositCnt, networkID, GER, nil)
require.NoError(t, err)
require.NotNil(t, smtProof)
require.NotNil(t, smtRollupProof)
require.NotNil(t, globaExitRoot)
}