From 7d4784df5f53aa527884cbf21c9d81012fb3a8c2 Mon Sep 17 00:00:00 2001 From: EclesioMeloJunior Date: Mon, 13 Jan 2025 11:06:27 -0400 Subject: [PATCH] chore: remove unneeded code --- dot/core/service_test.go | 117 --------------------------------------- 1 file changed, 117 deletions(-) diff --git a/dot/core/service_test.go b/dot/core/service_test.go index 3d1741b249..a7df8adba0 100644 --- a/dot/core/service_test.go +++ b/dot/core/service_test.go @@ -1500,120 +1500,3 @@ func TestService_GetReadProofAt(t *testing.T) { execTest(t, service, common.Hash{}, [][]byte{{1}}, common.Hash{2}, [][]byte{{2}}, nil) }) } - -func TestEmptyReturn(t *testing.T) { - testcase := map[string]struct { - setupSubsystemAndMessage func(t *testing.T) (*ProspectiveParachains, GetBackableCandidates) - }{ - "no_candidates_found": { - setupSubsystemAndMessage: func(t *testing.T) (*ProspectiveParachains, GetBackableCandidates) { - candidateRelayParent := common.Hash{0x01} - paraId := parachaintypes.ParaID(1) - mockRelayParent := relayChainBlockInfo{ - Hash: candidateRelayParent, - Number: 10, - } - - ancestors := []relayChainBlockInfo{} - baseConstraints := ¶chaintypes.Constraints{ - MinRelayParentNumber: 5, - } - - mockScope, err := newScopeWithAncestors(mockRelayParent, baseConstraints, nil, 10, ancestors) - assert.NoError(t, err) - - candidateStorage := newCandidateStorage() - - mockView := &View{ - activeLeaves: map[common.Hash]bool{ - candidateRelayParent: true, - }, - perRelayParent: map[common.Hash]*relayParentData{ - candidateRelayParent: { - fragmentChains: map[parachaintypes.ParaID]*fragmentChain{ - paraId: newFragmentChain(mockScope, candidateStorage), - }, - }, - }, - } - - pp := &ProspectiveParachains{ - View: mockView, - } - - msg := GetBackableCandidates{ - RelayParentHash: candidateRelayParent, - ParaId: paraId, - RequestedQty: 3, - Ancestors: mockAncestors, - Response: responseChan, - } - - return pp, msg - }, - }, - "relay_parent_not_active_leaf": { - setupSubsystemAndMessage: func(t *testing.T) (*ProspectiveParachains, GetBackableCandidates) { - candidateRelayParent := common.Hash{0x01} - paraId := parachaintypes.ParaID(1) - mockRelayParent := relayChainBlockInfo{ - Hash: candidateRelayParent, - Number: 10, - } - - ancestors := []relayChainBlockInfo{} - baseConstraints := ¶chaintypes.Constraints{ - MinRelayParentNumber: 5, - } - - mockScope, err := newScopeWithAncestors(mockRelayParent, baseConstraints, nil, 10, ancestors) - assert.NoError(t, err) - - candidateStorage := newCandidateStorage() - - mockView := &View{ - activeLeaves: map[common.Hash]bool{ - candidateRelayParent: true, - }, - perRelayParent: map[common.Hash]*relayParentData{ - candidateRelayParent: { - fragmentChains: map[parachaintypes.ParaID]*fragmentChain{ - paraId: newFragmentChain(mockScope, candidateStorage), - }, - }, - }, - } - - pp := &ProspectiveParachains{ - View: mockView, - } - - msg := GetBackableCandidates{ - RelayParentHash: candidateRelayParent, - ParaId: paraId, - RequestedQty: 3, - Ancestors: mockAncestors, - Response: responseChan, - } - - return pp, msg - }, - }, - } - - for tname, tt := range testcase { - tt := tt - t.Run(tname, func(t *testing.T) { - pp, msg := tt.setupSubsystemAndMessage() - pp.getBackableCandidates(msg) - - select { - case result := <-msg.responseChan: - assert.NotNil(t, result, "Result should not be nil") - assert.Equal(t, 0, len(result), "Expected 0 candidates to be returned") - default: - t.Fatal("No response received from getBackableCandidates") - } - }) - } -}