Added missing 'source' getter on Spec02
Signed-off-by: Michele Angioni <michele.angioni@takeaway.com>
This commit is contained in:
parent
2cc5999704
commit
41710130f1
|
@ -59,6 +59,10 @@ Spec02.prototype.source = function(_source){
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec02.prototype.getSource = function() {
|
||||||
|
return this.payload["source"];
|
||||||
|
};
|
||||||
|
|
||||||
Spec02.prototype.id = function(_id){
|
Spec02.prototype.id = function(_id){
|
||||||
this.payload["id"] = _id;
|
this.payload["id"] = _id;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -15,6 +15,19 @@ var cloudevent = new Cloudevent()
|
||||||
|
|
||||||
describe("CloudEvents Spec 0.1 - JavaScript SDK", () => {
|
describe("CloudEvents Spec 0.1 - JavaScript SDK", () => {
|
||||||
|
|
||||||
|
describe("Object properties", () => {
|
||||||
|
|
||||||
|
describe("Attribute getters", () => {
|
||||||
|
it("returns 'type'", () => {
|
||||||
|
expect(cloudevent.getType()).to.equal(type);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns 'source'", () => {
|
||||||
|
expect(cloudevent.getSource()).to.equal(source);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("JSON Format", () => {
|
describe("JSON Format", () => {
|
||||||
|
|
||||||
describe("Required context attributes", () => {
|
describe("Required context attributes", () => {
|
||||||
|
|
|
@ -9,13 +9,26 @@ const contenttype = "application/json";
|
||||||
const data = {};
|
const data = {};
|
||||||
const extensions = {};
|
const extensions = {};
|
||||||
|
|
||||||
var cloudevent =
|
var cloudevent =
|
||||||
new Cloudevent(Cloudevent.specs["0.2"])
|
new Cloudevent(Cloudevent.specs["0.2"])
|
||||||
.type(type)
|
.type(type)
|
||||||
.source(source);
|
.source(source);
|
||||||
|
|
||||||
describe("CloudEvents Spec 0.2 - JavaScript SDK", () => {
|
describe("CloudEvents Spec 0.2 - JavaScript SDK", () => {
|
||||||
|
|
||||||
|
describe("Object properties", () => {
|
||||||
|
|
||||||
|
describe("Attribute getters", () => {
|
||||||
|
it("returns 'type'", () => {
|
||||||
|
expect(cloudevent.getType()).to.equal(type);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns 'source'", () => {
|
||||||
|
expect(cloudevent.getSource()).to.equal(source);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("JSON Format", () => {
|
describe("JSON Format", () => {
|
||||||
|
|
||||||
describe("Required context attributes", () => {
|
describe("Required context attributes", () => {
|
||||||
|
@ -68,8 +81,8 @@ describe("CloudEvents Spec 0.2 - JavaScript SDK", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw an error when employ reserved name as extension", () => {
|
it("should throw an error when employ reserved name as extension", () => {
|
||||||
|
|
||||||
var cevt =
|
var cevt =
|
||||||
new Cloudevent(Cloudevent.specs["0.2"])
|
new Cloudevent(Cloudevent.specs["0.2"])
|
||||||
.type(type)
|
.type(type)
|
||||||
.source(source);
|
.source(source);
|
||||||
|
|
Loading…
Reference in New Issue