Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ddurschlag committed Aug 15, 2023
1 parent d4adb8b commit dbf7347
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
40 changes: 20 additions & 20 deletions deno/lib/__tests__/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ test("function inference 1", () => {
});

test("method parsing", () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
});
const methodInstance = {
property: 3,
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
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
});
const methodInstance = {
property: 3,
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
});

test("async method parsing", async () => {
const methodObject = z.object({
property: 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; }
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
const methodObject = z.object({
property: 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; }
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
});

test("args method", () => {
Expand Down
40 changes: 20 additions & 20 deletions src/__tests__/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@ test("function inference 1", () => {
});

test("method parsing", () => {
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
});
const methodInstance = {
property: 3,
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
const methodObject = z.object({
property: z.number(),
method: z.function().args(z.string()).returns(z.number())
});
const methodInstance = {
property: 3,
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
});

test("async method parsing", async () => {
const methodObject = z.object({
property: 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; }
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
const methodObject = z.object({
property: 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; }
};
const parsed = methodObject.parse(methodInstance);
expect(await parsed.method('length=8')).toBe(11); // 8 length + 3 property
});

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

0 comments on commit dbf7347

Please sign in to comment.