Skip to content

Commit

Permalink
new: test for cancelInvocationMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
philippseith committed Apr 6, 2024
1 parent db3d68b commit b743eb6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions messagepackhubprotocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,23 @@ var _ = Describe("MessagePackHubProtocol", func() {
Expect(reflect.Indirect(value).Interface()).To(Equal(message.Arguments[i]))
}
})
It("should encode/decode an CancelInvocationMessage", func() {
message := cancelInvocationMessage{
Type: 5,
InvocationID: "1",
}
buf := bytes.Buffer{}
err := protocol.WriteMessage(message, &buf)
Expect(err).NotTo(HaveOccurred())
remainBuf := bytes.Buffer{}
got, err := protocol.ParseMessages(&buf, &remainBuf)
Expect(err).NotTo(HaveOccurred())
Expect(remainBuf.Len()).To(Equal(0))
Expect(len(got)).To(Equal(1))
Expect(got[0]).To(BeAssignableToTypeOf(cancelInvocationMessage{}))
gotMsg := got[0].(cancelInvocationMessage)
Expect(gotMsg.Type).To(Equal(message.Type))
Expect(gotMsg.InvocationID).To(Equal(message.InvocationID))
})
})
})

0 comments on commit b743eb6

Please sign in to comment.