MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestValidateTrustOptions

Function TestValidateTrustOptions

light/client_test.go:70–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68)
69
70func TestValidateTrustOptions(t *testing.T) {
71 testCases := []struct {
72 err bool
73 to light.TrustOptions
74 }{
75 {
76 false,
77 trustOptions,
78 },
79 {
80 true,
81 light.TrustOptions{
82 Period: -1 * time.Hour,
83 Height: 1,
84 Hash: h1.Hash(),
85 },
86 },
87 {
88 true,
89 light.TrustOptions{
90 Period: 1 * time.Hour,
91 Height: 0,
92 Hash: h1.Hash(),
93 },
94 },
95 {
96 true,
97 light.TrustOptions{
98 Period: 1 * time.Hour,
99 Height: 1,
100 Hash: []byte("incorrect hash"),
101 },
102 },
103 }
104
105 for _, tc := range testCases {
106 err := tc.to.ValidateBasic()
107 if tc.err {
108 assert.Error(t, err)
109 } else {
110 assert.NoError(t, err)
111 }
112 }
113
114}
115
116func TestMock(t *testing.T) {
117 l, _ := fullNode.LightBlock(ctx, 3)

Callers

nothing calls this directly

Calls 3

HashMethod · 0.65
ValidateBasicMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected