From ccfe176d74317cac92040a3d3f0b576877f0e1da Mon Sep 17 00:00:00 2001 From: yiming1997 <1965768941@qq.com> Date: Wed, 15 May 2024 14:16:14 +0800 Subject: [PATCH] add:add a unit test for delivery push --- test_delivery_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test_delivery_test.go b/test_delivery_test.go index a2ced26..0fb2885 100644 --- a/test_delivery_test.go +++ b/test_delivery_test.go @@ -34,3 +34,15 @@ func TestDeliveryReject(t *testing.T) { assert.Equal(t, ErrorNotFound, delivery.Ack()) assert.Equal(t, Rejected, delivery.State) } + +func TestDeliveryPush(t *testing.T) { + delivery := NewTestDelivery("p") + assert.Equal(t, Unacked, delivery.State) + assert.NoError(t, delivery.Push()) + assert.Equal(t, Pushed, delivery.State) + + assert.Equal(t, ErrorNotFound, delivery.Push()) + assert.Equal(t, ErrorNotFound, delivery.Reject()) + assert.Equal(t, ErrorNotFound, delivery.Ack()) + assert.Equal(t, Pushed, delivery.State) +}