fix: initialize CloudEvent's extensions property (#192)
Signed-off-by: Ali Ok <aliok@redhat.com>
This commit is contained in:
parent
daf945c50e
commit
0710166ce9
|
@ -92,6 +92,7 @@ class CloudEvent {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
this.formatter = new Formatter();
|
this.formatter = new Formatter();
|
||||||
|
this.extensions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,6 +86,11 @@ describe("A 1.0 CloudEvent", () => {
|
||||||
expect(ce.data).to.equal(data);
|
expect(ce.data).to.equal(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("has extensions as an empty array by default", () => {
|
||||||
|
const ce = new CloudEvent(fixture);
|
||||||
|
expect(ce.extensions).to.be.an('array').that.has.a.lengthOf(0);
|
||||||
|
});
|
||||||
|
|
||||||
it("throws ValidationError if the CloudEvent does not conform to the schema");
|
it("throws ValidationError if the CloudEvent does not conform to the schema");
|
||||||
it("returns a JSON string even if format is invalid");
|
it("returns a JSON string even if format is invalid");
|
||||||
it("correctly formats a CloudEvent as JSON");
|
it("correctly formats a CloudEvent as JSON");
|
||||||
|
|
Loading…
Reference in New Issue