Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Aug 15, 2023
1 parent 0a055e7 commit 13d9e6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions deno/lib/__tests__/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,31 @@ test("function inference 1", () => {
test("method parsing", () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
method: z.function().args(z.string()).returns(z.number()),
});
const methodInstance = {
property: 3,
method: function(s: string) { return s.length + this.property; }
method: function (s: string) {
return s.length + this.property;
},
};
const parsed = methodObject.parse(methodInstance);
expect(parsed.method('length=8')).toBe(11); // 8 length + 3 property
expect(parsed.method("length=8")).toBe(11); // 8 length + 3 property
});

test("async method parsing", async () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.promise(z.number()))
method: z.function().args(z.string()).returns(z.promise(z.number())),
});
const methodInstance = {
property: 3,
method: async function(s: string) { return s.length + this.property; }
method: async function (s: string) {
return s.length + this.property;
},
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
expect(await parsed.method("length=8")).toBe(11); // 8 length + 3 property
});

test("args method", () => {
Expand Down
16 changes: 10 additions & 6 deletions src/__tests__/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,31 @@ test("function inference 1", () => {
test("method parsing", () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
method: z.function().args(z.string()).returns(z.number()),
});
const methodInstance = {
property: 3,
method: function(s: string) { return s.length + this.property; }
method: function (s: string) {
return s.length + this.property;
},
};
const parsed = methodObject.parse(methodInstance);
expect(parsed.method('length=8')).toBe(11); // 8 length + 3 property
expect(parsed.method("length=8")).toBe(11); // 8 length + 3 property
});

test("async method parsing", async () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.promise(z.number()))
method: z.function().args(z.string()).returns(z.promise(z.number())),
});
const methodInstance = {
property: 3,
method: async function(s: string) { return s.length + this.property; }
method: async function (s: string) {
return s.length + this.property;
},
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
expect(await parsed.method("length=8")).toBe(11); // 8 length + 3 property
});

test("args method", () => {
Expand Down

0 comments on commit 13d9e6b

Please sign in to comment.