Skip to content

Commit 4365f47

Browse files
committed
squash: can pass in an Object now
Signed-off-by: Lucas Holmquist <[email protected]>
1 parent 194cdf3 commit 4365f47

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/event/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ export const asData = (data: unknown, contentType: string): string => {
8282
};
8383

8484
export const isValidType = (v: boolean | number | string | Date | Uint32Array | unknown): boolean =>
85-
isBoolean(v) || isInteger(v) || isString(v) || isDate(v) || isBinary(v);
85+
isBoolean(v) || isInteger(v) || isString(v) || isDate(v) || isBinary(v) || isObject(v);

test/integration/spec_1_tests.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ describe("CloudEvents Spec v1.0", () => {
8787
expect(cloudevent.cloneWith({ extdate: myDate }).validate()).to.equal(true);
8888
});
8989

90-
it("should fail when the type is an object", () => {
91-
expect(() => {
92-
cloudevent.cloneWith({ objectextension: { some: "object" } });
93-
}).to.throw(ValidationError, "invalid extension value");
90+
it("should be ok when the type is an object", () => {
91+
expect(cloudevent.cloneWith({ objectextension: { some: "object" } }).validate()).to.equal(true);
9492
});
9593

9694
it("should be ok when the type is an string converted from an object", () => {

0 commit comments

Comments
 (0)