Skip to content

Commit 1abf8dc

Browse files
committed
squash: first step is to run validate at the en of the constructor
Signed-off-by: Lucas Holmquist <[email protected]>
1 parent 25077a9 commit 1abf8dc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/event/cloudevent.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ export class CloudEvent implements CloudEventV1, CloudEventV03 {
9898
for (const [key, value] of Object.entries(properties)) {
9999
this[key] = value;
100100
}
101+
102+
this.validate();
101103
}
102104

103105
get time(): string | Date {

test/cloud_event_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe("A 0.3 CloudEvent", () => {
139139
});
140140

141141
it("can be constructed with a datacontentencoding", () => {
142-
const ce = new CloudEvent({ datacontentencoding: "Base64", ...v03fixture });
142+
const ce = new CloudEvent({ datacontentencoding: "Base64", ...v03fixture, data: "SSB3YXMgZnVubnkg8J+Ygg==" });
143143
expect(ce.datacontentencoding).to.equal("Base64");
144144
});
145145

0 commit comments

Comments
 (0)