{"id":"8a901064-934c-4453-afd5-1ba8ca165d19","slug":"anivar-zod-testing","name":"zod-testing","description":"Testing patterns for Zod schemas using Jest and Vitest. Covers schema correctness testing, mock data generation, error assertion patterns, integration testing with API handlers and forms, snapshot testing with z.toJSONSchema(), and property-based testing. Baseline: zod ^4.0.0. Triggers on: test files for Zod schemas, zod-schema-faker imports, mentions of \"test schema\", \"schema test\", \"zod mock\", \"zod test\", or schema testing patterns.","canonicalUrl":"https://www.xpersona.co/skill/anivar-zod-testing","sourceUrl":"https://github.com/anivar/zod-testing","homepage":null,"source":"GITHUB_OPENCLEW","vendor":{"slug":"anivar","label":"Anivar","url":"https://github.com/anivar/zod-testing"},"protocols":["OPENCLEW"],"capabilities":[],"trustScore":null,"trustConfidence":"unknown","artifactCount":0,"benchmarkCount":0,"lastRelease":null,"freshnessAt":"2026-04-14T22:26:07.600Z","freshnessLabel":"Apr 14, 2026","securityReviewed":true,"openapiReady":false,"stats":[{"label":"Trust score","value":"Unknown"},{"label":"Compatibility","value":"OpenClaw"},{"label":"Freshness","value":"Apr 14, 2026"},{"label":"Vendor","value":"Anivar"},{"label":"Artifacts","value":"0"},{"label":"Benchmarks","value":"0"},{"label":"Last release","value":"Unpublished"}],"factsPreview":[{"factKey":"docs_crawl","category":"integration","label":"Crawlable docs","value":"6 indexed pages on the official domain","href":"https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenclaw%2Fskills%2Ftree%2Fmain%2Fskills%2Fasleep123%2Fcaldav-calendar","sourceUrl":"https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenclaw%2Fskills%2Ftree%2Fmain%2Fskills%2Fasleep123%2Fcaldav-calendar","sourceType":"search_document","confidence":"medium","observedAt":"2026-04-15T05:03:46.393Z","isPublic":true},{"factKey":"vendor","category":"vendor","label":"Vendor","value":"Anivar","href":"https://github.com/anivar/zod-testing","sourceUrl":"https://github.com/anivar/zod-testing","sourceType":"profile","confidence":"medium","observedAt":"2026-04-14T22:26:07.600Z","isPublic":true},{"factKey":"protocols","category":"compatibility","label":"Protocol compatibility","value":"OpenClaw","href":"https://www.xpersona.co/api/v1/agents/anivar-zod-testing/contract","sourceUrl":"https://www.xpersona.co/api/v1/agents/anivar-zod-testing/contract","sourceType":"contract","confidence":"medium","observedAt":"2026-04-14T22:26:07.600Z","isPublic":true},{"factKey":"traction","category":"adoption","label":"Adoption signal","value":"2 GitHub stars","href":"https://github.com/anivar/zod-testing","sourceUrl":"https://github.com/anivar/zod-testing","sourceType":"profile","confidence":"medium","observedAt":"2026-04-14T22:26:07.600Z","isPublic":true},{"factKey":"handshake_status","category":"security","label":"Handshake status","value":"UNKNOWN","href":"https://www.xpersona.co/api/v1/agents/anivar-zod-testing/trust","sourceUrl":"https://www.xpersona.co/api/v1/agents/anivar-zod-testing/trust","sourceType":"trust","confidence":"medium","observedAt":null,"isPublic":true}],"highlights":["2 GitHub stars","Trust evidence available"],"agentCard":{"name":"zod-testing","description":"Testing patterns for Zod schemas using Jest and Vitest. Covers schema correctness testing, mock data generation, error assertion patterns, integration testing with API handlers and forms, snapshot testing with z.toJSONSchema(), and property-based testing. Baseline: zod ^4.0.0. Triggers on: test files for Zod schemas, zod-schema-faker imports, mentions of \"test schema\", \"schema test\", \"zod mock\", \"zod test\", or schema testing patterns.","source":"GITHUB_OPENCLEW","sourceId":"github:1164579612","repository":"https://github.com/anivar/zod-testing","documentation":"https://www.xpersona.co/skill/anivar-zod-testing/agent/anivar-zod-testing","protocols":["OPENCLEW"],"languages":["typescript"],"install":{"command":"git clone https://github.com/anivar/zod-testing.git","ecosystem":"git"},"examples":[{"kind":"example","language":"typescript","snippet":"import { describe, it, expect } from \"vitest\" // or jest\nimport { z } from \"zod\"\n\nconst UserSchema = z.object({\n  name: z.string().min(1),\n  email: z.email(),\n  age: z.number().min(0).max(150),\n})\n\ndescribe(\"UserSchema\", () => {\n  it(\"accepts valid data\", () => {\n    const result = UserSchema.safeParse({\n      name: \"Alice\",\n      email: \"alice@example.com\",\n      age: 30,\n    })\n    expect(result.success).toBe(true)\n  })\n\n  it(\"rejects missing required fields\", () => {\n    const result = UserSchema.safeParse({})\n    expect(result.success).toBe(false)\n    if (!result.success) {\n      const flat = z.flattenError(result.error)\n      expect(flat.fieldErrors.name).toBeDefined()\n      expect(flat.fieldErrors.email).toBeDefined()\n    }\n  })\n\n  it(\"rejects invalid email\", () => {\n    const result = UserSchema.safeParse({\n      name: \"Alice\",\n      email: \"not-an-email\",\n      age: 30,\n    })\n    expect(result.success).toBe(false)\n  })\n\n  it(\"rejects negative age\", () => {\n    const result = UserSchema.safeParse({\n      name: \"Alice\",\n      email: \"alice@example.com\",\n      age: -1,\n    })\n    expect(result.success).toBe(false)\n  })\n})"},{"kind":"example","language":"typescript","snippet":"// GOOD: test doesn't crash — asserts on result\nconst result = schema.safeParse(invalidData)\nexpect(result.success).toBe(false)\n\n// BAD: test crashes instead of failing\nexpect(() => schema.parse(invalidData)).toThrow()\n// If schema changes and starts accepting, this still passes"}]}}