Test for extensions
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
6960e42c24
commit
7d67e27d07
|
@ -15,6 +15,11 @@ const data = {
|
||||||
foo: "bar"
|
foo: "bar"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ext1Name = "extension1";
|
||||||
|
const ext1Value = "foobar";
|
||||||
|
const ext2Name = "extension2";
|
||||||
|
const ext2Value = "acme";
|
||||||
|
|
||||||
const Structured01 = Cloudevent.bindings["http-structured0.1"];
|
const Structured01 = Cloudevent.bindings["http-structured0.1"];
|
||||||
const Binary01 = Cloudevent.bindings["http-binary0.1"];
|
const Binary01 = Cloudevent.bindings["http-binary0.1"];
|
||||||
|
|
||||||
|
@ -25,7 +30,9 @@ var cloudevent =
|
||||||
.contenttype(ceContentType)
|
.contenttype(ceContentType)
|
||||||
.time(now)
|
.time(now)
|
||||||
.schemaurl(schemaurl)
|
.schemaurl(schemaurl)
|
||||||
.data(data);
|
.data(data)
|
||||||
|
.addExtension(ext1Name, ext1Value)
|
||||||
|
.addExtension(ext2Name, ext2Value);
|
||||||
|
|
||||||
cloudevent.eventTypeVersion("1.0.0");
|
cloudevent.eventTypeVersion("1.0.0");
|
||||||
|
|
||||||
|
@ -90,6 +97,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-EventType");
|
.to.have.property("CE-EventType");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-EventTypeVersion'", () => {
|
it("HTTP Header contains 'CE-EventTypeVersion'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -97,6 +105,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-EventTypeVersion");
|
.to.have.property("CE-EventTypeVersion");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-CloudEventsVersion'", () => {
|
it("HTTP Header contains 'CE-CloudEventsVersion'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -104,6 +113,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-CloudEventsVersion");
|
.to.have.property("CE-CloudEventsVersion");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-Source'", () => {
|
it("HTTP Header contains 'CE-Source'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -111,6 +121,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-Source");
|
.to.have.property("CE-Source");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-EventID'", () => {
|
it("HTTP Header contains 'CE-EventID'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -118,6 +129,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-EventID");
|
.to.have.property("CE-EventID");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-EventTime'", () => {
|
it("HTTP Header contains 'CE-EventTime'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -125,6 +137,7 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-EventTime");
|
.to.have.property("CE-EventTime");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("HTTP Header contains 'CE-SchemaURL'", () => {
|
it("HTTP Header contains 'CE-SchemaURL'", () => {
|
||||||
return httpbinary01.emit(cloudevent)
|
return httpbinary01.emit(cloudevent)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -132,6 +145,14 @@ describe("HTTP Transport Binding - Version 0.1", () => {
|
||||||
.to.have.property("CE-SchemaURL");
|
.to.have.property("CE-SchemaURL");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("HTTP Header contains 'CE-X-Extension1' as extension", () => {
|
||||||
|
return httpbinary01.emit(cloudevent)
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.config.headers)
|
||||||
|
.to.have.property("CE-X-Extension1");
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue