Skip to content

Commit

Permalink
test(impl): add unit test for incomplete response
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Sep 29, 2020
1 parent f1e5fe0 commit cec9d80
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions impl/responding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,27 @@ func TestDataTransferResponding(t *testing.T) {
require.False(t, response.IsPaused())
},
},
"validated, incomplete response": {
expectedEvents: []datatransfer.EventCode{
datatransfer.Open,
datatransfer.NewVoucherResult,
datatransfer.Accept,
datatransfer.Error,
datatransfer.CleanupComplete,
},
configureValidator: func(sv *testutil.StubbedValidator) {
sv.ExpectSuccessPull()
sv.StubResult(testutil.NewFakeDTType())
},
configureRevalidator: func(srv *testutil.StubbedRevalidator) {
},
verify: func(t *testing.T, h *receiverHarness) {
_, err := h.transport.EventHandler.OnRequestReceived(channelID(h.id, h.peers), h.pullRequest)
require.NoError(t, err)
err = h.transport.EventHandler.OnChannelCompleted(channelID(h.id, h.peers), false)
require.NoError(t, err)
},
},
"new push request, customized transport": {
expectedEvents: []datatransfer.EventCode{datatransfer.Open, datatransfer.NewVoucherResult, datatransfer.Accept},
configureValidator: func(sv *testutil.StubbedValidator) {
Expand Down

0 comments on commit cec9d80

Please sign in to comment.