From c1e858fbd638aa458a7d862e2d10989c3ccf555f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Sun, 16 Jun 2019 19:14:29 -0300 Subject: [PATCH] Happy path test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- .../http/receiver_strutured_0_2_test.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/bindings/http/receiver_strutured_0_2_test.js b/test/bindings/http/receiver_strutured_0_2_test.js index d668fd3..076c4ce 100644 --- a/test/bindings/http/receiver_strutured_0_2_test.js +++ b/test/bindings/http/receiver_strutured_0_2_test.js @@ -114,5 +114,29 @@ describe("HTTP Transport Binding Structured Receiver 0.2", () => { expect(receiver.parse.bind(receiver, payload, headers)) .to.throw("invalid payload"); }); + + it("Should accept event that follow the spec 0.2", () => { + // setup + var payload = + new Cloudevent(Cloudevent.specs["0.2"]) + .type(type) + .source(source) + .contenttype(ceContentType) + .time(now) + .schemaurl(schemaurl) + .data(data) + .toString(); + + var headers = { + "content-type":"application/cloudevents+json" + }; + + // act + var actual = receiver.parse(payload, headers); + + // assert + expect(actual) + .to.be.an("object"); + }); }); });