From 40c96c40db4cee07faa0f64da8054536521f124e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Fri, 2 Aug 2019 11:21:17 -0300 Subject: [PATCH] Tests for checking the binary headers value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- test/http_binding_0_3.js | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/test/http_binding_0_3.js b/test/http_binding_0_3.js index 6cb4af6..441e821 100644 --- a/test/http_binding_0_3.js +++ b/test/http_binding_0_3.js @@ -188,6 +188,70 @@ describe("HTTP Transport Binding - Version 0.3", () => { }); }); + it("should 'ce-type' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getType()) + .to.equal(response.config.headers["ce-type"]); + }); + }); + + it("should 'ce-specversion' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getSpecversion()) + .to.equal(response.config.headers["ce-specversion"]); + }); + }); + + it("should 'ce-source' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getSource()) + .to.equal(response.config.headers["ce-source"]); + }); + }); + + it("should 'ce-id' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getId()) + .to.equal(response.config.headers["ce-id"]); + }); + }); + + it("should 'ce-time' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getTime()) + .to.equal(response.config.headers["ce-time"]); + }); + }); + + it("should 'ce-schemaurl' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getSchemaurl()) + .to.equal(response.config.headers["ce-schemaurl"]); + }); + }); + + it("should 'ce-" + ext1Name + "' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getExtensions()[ext1Name]) + .to.equal(response.config.headers["ce-" + ext1Name]); + }); + }); + + it("should 'ce-" + ext2Name + "' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getExtensions()[ext2Name]) + .to.equal(response.config.headers["ce-" + ext2Name]); + }); + }); + it("should 'ce-subject' have the right value", () => { return binary.emit(cloudevent) .then((response) => { @@ -204,6 +268,14 @@ describe("HTTP Transport Binding - Version 0.3", () => { .to.have.property("ce-datacontentencoding"); }); }); + + it("should 'ce-datacontentencoding' have the right value", () => { + return binary.emit(cloudevent) + .then((response) => { + expect(cloudevent.getDataContentEncoding()) + .to.equal(response.config.headers["ce-datacontentencoding"]); + }); + }); }); }); });