From 8916cbdcf6eeaa11ad02522bd6dbc7d72cf471e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Tue, 11 Jun 2019 11:22:03 -0300 Subject: [PATCH] Test the happy path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- test/bindings/http/unmarshaller_0_2_tests.js | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/bindings/http/unmarshaller_0_2_tests.js b/test/bindings/http/unmarshaller_0_2_tests.js index 2dc18ad..f20d920 100644 --- a/test/bindings/http/unmarshaller_0_2_tests.js +++ b/test/bindings/http/unmarshaller_0_2_tests.js @@ -98,5 +98,31 @@ describe("HTTP Transport Binding Unmarshaller", () => { expect(un.unmarshall.bind(un, 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" + }; + + var un = new Unmarshaller(); + + // act + var actual = un.unmarshall(payload, headers); + + // assert + expect(actual) + .to.be.an("object"); + }); }); });