Skip to content

Commit

Permalink
finish tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 committed Sep 9, 2020
1 parent 5a6bded commit 6f2bad8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions impl/responding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,19 @@ func TestDataTransferRestartResponding(t *testing.T) {
configureRevalidator func(sv *testutil.StubbedRevalidator)
verify func(t *testing.T, h *receiverHarness)
}{
"receiving a pull restart response": {
expectedEvents: []datatransfer.EventCode{datatransfer.Open, datatransfer.Restart, datatransfer.ResumeResponder},
verify: func(t *testing.T, h *receiverHarness) {
channelID, err := h.dt.OpenPushDataChannel(h.ctx, h.peers[1], h.voucher, h.baseCid, h.stor)
require.NoError(t, err)
require.NotEmpty(t, channelID)

response, err := message.RestartResponse(channelID.ID, true, false, datatransfer.EmptyTypeIdentifier, nil)
require.NoError(t, err)
err = h.transport.EventHandler.OnResponseReceived(channelID, response)
require.NoError(t, err)
},
},
"receiving a push restart request validates and opens a channel for pull": {
expectedEvents: []datatransfer.EventCode{datatransfer.Open, datatransfer.NewVoucherResult, datatransfer.Accept,
datatransfer.DataReceived, datatransfer.DataReceived, datatransfer.NewVoucherResult, datatransfer.Restart},
Expand Down

0 comments on commit 6f2bad8

Please sign in to comment.