INNER CODE UNIT · Go
Test_entryWithArgsAndChainBlock
alibaba/sentinel-golang · api/api_test.go:122
func Test_entryWithArgsAndChainBlock(t *testing.T) {
sc := base.NewSlotChain()
ps1 := &prepareSlotMock{}
rcs1 := &mockRuleCheckSlot1{}
rcs2 := &mockRuleCheckSlot2{}
ssm := &statisticSlotMock{}
sc.AddStatPrepareSlot(ps1)
sc.AddRuleCheckSlot(rcs1)
sc.AddRuleCheckSlot(rcs2)
sc.AddStatSlot(ssm)
blockType := base.BlockTypeFlow
ps1.On("Prepare", mock.Anything).Return()
rcs1.On("Check", mock.Anything).Return(base.NewTokenResultBlocked(blockType))
rcs2.On("Check", mock.Anything).Return(base.NewTokenResultPass())
ssm.On("OnEntryPassed", mock.Anything).Return()
ssm.On("OnEntryBlocked", mock.Anything, mock.Anything).Return()