Skip to content

Commit

Permalink
squash: can pass in an Object now
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
  • Loading branch information
lholmquist committed Jul 24, 2020
1 parent 194cdf3 commit 4365f47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/event/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ export const asData = (data: unknown, contentType: string): string => {
};

export const isValidType = (v: boolean | number | string | Date | Uint32Array | unknown): boolean =>
isBoolean(v) || isInteger(v) || isString(v) || isDate(v) || isBinary(v);
isBoolean(v) || isInteger(v) || isString(v) || isDate(v) || isBinary(v) || isObject(v);
6 changes: 2 additions & 4 deletions test/integration/spec_1_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ describe("CloudEvents Spec v1.0", () => {
expect(cloudevent.cloneWith({ extdate: myDate }).validate()).to.equal(true);
});

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

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

0 comments on commit 4365f47

Please sign in to comment.