MCPcopy
hub / github.com/canopy-network/canopy / TestCertificateResultsCheckBasic

Function TestCertificateResultsCheckBasic

lib/certificate_test.go:229–391  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

227}
228
229func TestCertificateResultsCheckBasic(t *testing.T) {
230 tests := []struct {
231 name string
232 detail string
233 result *CertificateResult
234 error string
235 }{
236 {
237 name: "nil",
238 detail: "certificate result is nil or empty",
239 result: nil,
240 error: "certificate results is empty",
241 },
242 {
243 name: "nil reward recipient",
244 detail: "reward recipients is nil or empty",
245 result: &CertificateResult{
246 RewardRecipients: nil,
247 },
248 error: "reward recipients is nil",
249 },
250 {
251 name: "payment recipients count",
252 detail: "there's an invalid number of payment recipients",
253 result: &CertificateResult{
254 RewardRecipients: &RewardRecipients{
255 PaymentPercents: nil,
256 },
257 },
258 error: "invalid payment recipients count",
259 },
260 {
261 name: "empty chain id",
262 detail: "the chain id cannot be empty",
263 result: &CertificateResult{
264 RewardRecipients: &RewardRecipients{
265 PaymentPercents: []*PaymentPercents{{
266 Address: newTestAddressBytes(t),
267 Percent: 100,
268 }},
269 },
270 SlashRecipients: &SlashRecipients{
271 DoubleSigners: []*DoubleSigner{nil},
272 },
273 },
274 error: "empty chain id",
275 },
276 {
277 name: "invalid double signer",
278 detail: "a double signer can't be nil",
279 result: &CertificateResult{
280 RewardRecipients: &RewardRecipients{
281 PaymentPercents: []*PaymentPercents{{
282 Address: newTestAddressBytes(t),
283 ChainId: CanopyChainId,
284 Percent: 100,
285 }},
286 },

Callers

nothing calls this directly

Calls 5

RunMethod · 0.80
EqualMethod · 0.80
newTestAddressBytesFunction · 0.70
newTestOrderIdFunction · 0.70
CheckBasicMethod · 0.45

Tested by

no test coverage detected