diff --git a/README.md b/README.md index 338af0d..288012e 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ npm install --save-dev zod-schema-faker ## Usage ```ts -import * as z from 'zod' +import { z } from 'zod' import { install, fake } from 'zod-schema-faker' const schema = z.number() @@ -269,7 +269,7 @@ const data = { - `function seed(value)`: sets the seed to use ```ts - import * as z from 'zod' + import { z } from 'zod' import { install, fake, seed } from 'zod-schema-faker' install() diff --git a/e2e/issue-189/src/index.ts b/e2e/issue-189/src/index.ts index f77f98a..82ad958 100644 --- a/e2e/issue-189/src/index.ts +++ b/e2e/issue-189/src/index.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { install, fake } from 'zod-schema-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/playground/src/main.ts b/playground/src/main.ts index c99e822..efef719 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { install, fake } from 'zod-schema-faker' const main = async () => { diff --git a/src/fake.ts b/src/fake.ts index b52fb58..33993cc 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodSchemaFakerError } from './error' -import { assertZodSchema } from './utils' +import { assertsZodSchema } from './utils' export const zodTypeKindToZodTypeFaker: Map = new Map() export const zodTypeToZodTypeFaker: Map = new Map() @@ -9,7 +9,7 @@ export const zodTypeToZodTypeFaker: Map(schema: T): z.infer => { - assertZodSchema(schema) + assertsZodSchema(schema) const typeName = (schema._def as any).typeName const faker = zodTypeToZodTypeFaker.get(schema) ?? zodTypeKindToZodTypeFaker.get(typeName) diff --git a/src/index.ts b/src/index.ts index 805a914..dd12563 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { z } from 'zod' import { fake as _fake } from './fake' -import { resetSeed } from './faker' +import { resetSeed } from './random' export const fake = (schema: T): z.infer => { const result = _fake(schema) @@ -8,7 +8,7 @@ export const fake = (schema: T): z.infer => { return result } -export { seed, runFake, randexp } from './faker' +export { seed, runFake, randexp } from './random' export { install, installCustom } from './zod-type-kind-to-zod-type-faker' export { ZodSchemaFakerError } from './error' export { ZodTypeFaker } from './zod-type-faker' diff --git a/src/faker.ts b/src/random.ts similarity index 100% rename from src/faker.ts rename to src/random.ts diff --git a/src/utils.ts b/src/utils.ts index bd2aba7..731e1b5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,13 @@ +import { z } from 'zod' import { ZodSchemaFakerError } from './error' -export const assertZodSchema = (schema: any): void | never => { - if (typeof schema !== 'object' || schema === null || typeof schema._parse !== 'function') { +export function assertsZodSchema(schema: unknown): asserts schema is z.ZodTypeAny { + if ( + typeof schema !== 'object' || + schema === null || + '_parse' in schema === false || + typeof schema._parse !== 'function' + ) { throw new ZodSchemaFakerError(`Expected a zod schema, but got ${schema}`) } } diff --git a/src/zod-any-faker.ts b/src/zod-any-faker.ts index 42f6b0c..5aa59ff 100644 --- a/src/zod-any-faker.ts +++ b/src/zod-any-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' const schemas = (() => { diff --git a/src/zod-array-faker.ts b/src/zod-array-faker.ts index 5d65f19..350cde7 100644 --- a/src/zod-array-faker.ts +++ b/src/zod-array-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodArrayFaker> extends ZodTypeFaker { diff --git a/src/zod-bigint-faker.ts b/src/zod-bigint-faker.ts index 1b81853..8862d67 100644 --- a/src/zod-bigint-faker.ts +++ b/src/zod-bigint-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodBigIntFaker extends ZodTypeFaker { diff --git a/src/zod-boolean-faker.ts b/src/zod-boolean-faker.ts index 72e179d..a8b406e 100644 --- a/src/zod-boolean-faker.ts +++ b/src/zod-boolean-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodBooleanFaker extends ZodTypeFaker { diff --git a/src/zod-branded-faker.ts b/src/zod-branded-faker.ts index 986a611..d1049cc 100644 --- a/src/zod-branded-faker.ts +++ b/src/zod-branded-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-date-faker.ts b/src/zod-date-faker.ts index 853367c..8d3d969 100644 --- a/src/zod-date-faker.ts +++ b/src/zod-date-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodDateFaker extends ZodTypeFaker { diff --git a/src/zod-default-faker.ts b/src/zod-default-faker.ts index 4828308..6dcc8c8 100644 --- a/src/zod-default-faker.ts +++ b/src/zod-default-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodDefaultFaker> extends ZodTypeFaker { diff --git a/src/zod-discriminated-union-faker.ts b/src/zod-discriminated-union-faker.ts index 898299f..e6017d3 100644 --- a/src/zod-discriminated-union-faker.ts +++ b/src/zod-discriminated-union-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodDiscriminatedUnionFaker> extends ZodTypeFaker { diff --git a/src/zod-effects-faker.ts b/src/zod-effects-faker.ts index 1c4d6da..84b2e8f 100644 --- a/src/zod-effects-faker.ts +++ b/src/zod-effects-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-enum-faker.ts b/src/zod-enum-faker.ts index 4030ab6..63960ef 100644 --- a/src/zod-enum-faker.ts +++ b/src/zod-enum-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodEnumFaker> extends ZodTypeFaker { diff --git a/src/zod-function-faker.ts b/src/zod-function-faker.ts index d9ecb5b..f8d1c98 100644 --- a/src/zod-function-faker.ts +++ b/src/zod-function-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-intersection-faker.ts b/src/zod-intersection-faker.ts index 557b55c..aa7c613 100644 --- a/src/zod-intersection-faker.ts +++ b/src/zod-intersection-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodSchemaFakerError } from './error' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-lazy-faker.ts b/src/zod-lazy-faker.ts index 559b7e2..ff6b7e4 100644 --- a/src/zod-lazy-faker.ts +++ b/src/zod-lazy-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodSchemaFakerError } from './error' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-literal-faker.ts b/src/zod-literal-faker.ts index 944c54a..c7491d4 100644 --- a/src/zod-literal-faker.ts +++ b/src/zod-literal-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodLiteralFaker> extends ZodTypeFaker { diff --git a/src/zod-map-faker.ts b/src/zod-map-faker.ts index 9ca3ce8..dba4f78 100644 --- a/src/zod-map-faker.ts +++ b/src/zod-map-faker.ts @@ -1,7 +1,7 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' -import { runFake } from './faker' +import { runFake } from './random' export class ZodMapFaker> extends ZodTypeFaker { fake(): z.infer { diff --git a/src/zod-nan-faker.ts b/src/zod-nan-faker.ts index 602ed08..c9a1598 100644 --- a/src/zod-nan-faker.ts +++ b/src/zod-nan-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodNaNFaker extends ZodTypeFaker { diff --git a/src/zod-native-enum-faker.ts b/src/zod-native-enum-faker.ts index 82a363b..43847e4 100644 --- a/src/zod-native-enum-faker.ts +++ b/src/zod-native-enum-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' const getValidEnumValues = (obj: any) => { diff --git a/src/zod-never-faker.ts b/src/zod-never-faker.ts index ef25e7a..9a36c97 100644 --- a/src/zod-never-faker.ts +++ b/src/zod-never-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodNeverFaker extends ZodTypeFaker { diff --git a/src/zod-null-faker.ts b/src/zod-null-faker.ts index 9423b1b..6cb0831 100644 --- a/src/zod-null-faker.ts +++ b/src/zod-null-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodNullFaker extends ZodTypeFaker { diff --git a/src/zod-nullable-faker.ts b/src/zod-nullable-faker.ts index b1d9c8d..0dec54f 100644 --- a/src/zod-nullable-faker.ts +++ b/src/zod-nullable-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodNullableFaker> extends ZodTypeFaker { diff --git a/src/zod-number-faker.ts b/src/zod-number-faker.ts index d4cdbf3..c93989e 100644 --- a/src/zod-number-faker.ts +++ b/src/zod-number-faker.ts @@ -1,5 +1,5 @@ -import * as z from 'zod' -import { runFake } from './faker' +import { z } from 'zod' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodNumberFaker extends ZodTypeFaker { diff --git a/src/zod-object-faker.ts b/src/zod-object-faker.ts index 829e6c3..1f08566 100644 --- a/src/zod-object-faker.ts +++ b/src/zod-object-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-optional-faker.ts b/src/zod-optional-faker.ts index 9e3ddc8..796c531 100644 --- a/src/zod-optional-faker.ts +++ b/src/zod-optional-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodOptionalFaker> extends ZodTypeFaker { diff --git a/src/zod-pipe-faker.ts b/src/zod-pipe-faker.ts index f95250e..7312cb6 100644 --- a/src/zod-pipe-faker.ts +++ b/src/zod-pipe-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-promise-faker.ts b/src/zod-promise-faker.ts index 4062d9c..54921f4 100644 --- a/src/zod-promise-faker.ts +++ b/src/zod-promise-faker.ts @@ -1,7 +1,7 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' -import { runFake } from './faker' +import { runFake } from './random' export class ZodPromiseFaker> extends ZodTypeFaker { fake(): z.infer { diff --git a/src/zod-readonly-faker.ts b/src/zod-readonly-faker.ts index 907408c..5ad7e0d 100644 --- a/src/zod-readonly-faker.ts +++ b/src/zod-readonly-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' diff --git a/src/zod-record-faker.ts b/src/zod-record-faker.ts index 2efbf3e..7c00cc7 100644 --- a/src/zod-record-faker.ts +++ b/src/zod-record-faker.ts @@ -1,7 +1,7 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' import { ZodTypeFaker } from './zod-type-faker' -import { runFake } from './faker' +import { runFake } from './random' import { ZodSchemaFakerError } from './error' export class ZodRecordFaker> extends ZodTypeFaker { diff --git a/src/zod-set-faker.ts b/src/zod-set-faker.ts index 37629c6..8490671 100644 --- a/src/zod-set-faker.ts +++ b/src/zod-set-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' +import { z } from 'zod' import { fake } from './fake' -import { runFake } from './faker' +import { runFake } from './random' import { ZodTypeFaker } from './zod-type-faker' export class ZodSetFaker> extends ZodTypeFaker { diff --git a/src/zod-string-faker.ts b/src/zod-string-faker.ts index 36e2c7f..b0f8790 100644 --- a/src/zod-string-faker.ts +++ b/src/zod-string-faker.ts @@ -1,7 +1,7 @@ -import * as z from 'zod' -import { ZodSchemaFakerError } from './error' -import { randexp, runFake } from './faker' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' +import { ZodSchemaFakerError } from './error' +import { randexp, runFake } from './random' const averageWordLength = 5 const averageSentenceLength = averageWordLength * 15 diff --git a/src/zod-symbol-faker.ts b/src/zod-symbol-faker.ts index 422de8b..c87a058 100644 --- a/src/zod-symbol-faker.ts +++ b/src/zod-symbol-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodSymbolFaker extends ZodTypeFaker { diff --git a/src/zod-tuple-faker.ts b/src/zod-tuple-faker.ts index 42f0292..5c00a17 100644 --- a/src/zod-tuple-faker.ts +++ b/src/zod-tuple-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' -import { fake } from './fake' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' +import { fake } from './fake' export class ZodTupleFaker> extends ZodTypeFaker { fake(): z.infer { diff --git a/src/zod-type-faker.ts b/src/zod-type-faker.ts index be01555..19baba8 100644 --- a/src/zod-type-faker.ts +++ b/src/zod-type-faker.ts @@ -1,13 +1,9 @@ -import * as z from 'zod' -import { assertZodSchema } from './utils' +import { z } from 'zod' +import { assertsZodSchema } from './utils' -export abstract class ZodTypeFaker> { - protected schema: T - - constructor(schema: T) { - assertZodSchema(schema) - - this.schema = schema +export abstract class ZodTypeFaker { + constructor(protected schema: T) { + assertsZodSchema(schema) } abstract fake(): z.infer diff --git a/src/zod-type-kind-to-zod-type-faker.ts b/src/zod-type-kind-to-zod-type-faker.ts index b398ec1..ec3559f 100644 --- a/src/zod-type-kind-to-zod-type-faker.ts +++ b/src/zod-type-kind-to-zod-type-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { zodTypeKindToZodTypeFaker, zodTypeToZodTypeFaker } from './fake' import { ZodAnyFaker } from './zod-any-faker' import { ZodArrayFaker } from './zod-array-faker' diff --git a/src/zod-undefined-faker.ts b/src/zod-undefined-faker.ts index 5c4fb7d..809207f 100644 --- a/src/zod-undefined-faker.ts +++ b/src/zod-undefined-faker.ts @@ -1,4 +1,4 @@ -import * as z from 'zod' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodUndefinedFaker extends ZodTypeFaker { diff --git a/src/zod-union-faker.ts b/src/zod-union-faker.ts index 73d5b1d..d8bce63 100644 --- a/src/zod-union-faker.ts +++ b/src/zod-union-faker.ts @@ -1,7 +1,7 @@ -import * as z from 'zod' -import { fake } from './fake' -import { runFake } from './faker' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' +import { fake } from './fake' +import { runFake } from './random' export class ZodUnionFaker> extends ZodTypeFaker { fake(): z.infer { diff --git a/src/zod-unknown-faker.ts b/src/zod-unknown-faker.ts index 2f7a2dd..d4aad3d 100644 --- a/src/zod-unknown-faker.ts +++ b/src/zod-unknown-faker.ts @@ -1,6 +1,6 @@ -import * as z from 'zod' -import { fake } from './fake' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' +import { fake } from './fake' export class ZodUnknownFaker extends ZodTypeFaker { fake(): z.infer { diff --git a/src/zod-void-faker.ts b/src/zod-void-faker.ts index 04ad5e4..4a0d170 100644 --- a/src/zod-void-faker.ts +++ b/src/zod-void-faker.ts @@ -1,5 +1,4 @@ -import * as z from 'zod' -import { fake } from './fake' +import { z } from 'zod' import { ZodTypeFaker } from './zod-type-faker' export class ZodVoidFaker extends ZodTypeFaker { diff --git a/tests/fake.test.ts b/tests/fake.test.ts index 38c88d2..cb71ac1 100644 --- a/tests/fake.test.ts +++ b/tests/fake.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { fake, install } from '../src' import { uninstall } from '../src/zod-type-kind-to-zod-type-faker' diff --git a/tests/faker.test.ts b/tests/faker.test.ts index 215d7a0..7357bb5 100644 --- a/tests/faker.test.ts +++ b/tests/faker.test.ts @@ -1,7 +1,6 @@ import { expect, test } from 'vitest' -import * as z from 'zod' -import { install, fake, seed } from '../src' -import { runFake } from '../src/faker' +import { z } from 'zod' +import { install, fake, seed, runFake } from '../src' test('seed', () => { install() diff --git a/tests/integration.test.ts b/tests/integration.test.ts index 9c72015..1948859 100644 --- a/tests/integration.test.ts +++ b/tests/integration.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { fake, install } from '../src' import { testMultipleTimes } from './util' diff --git a/tests/utils.test.ts b/tests/utils.test.ts index 3359146..c13cadc 100644 --- a/tests/utils.test.ts +++ b/tests/utils.test.ts @@ -1,19 +1,19 @@ import { expect, test } from 'vitest' -import * as z from 'zod' -import { assertZodSchema } from '../src/utils' +import { z } from 'zod' +import { assertsZodSchema } from '../src/utils' -test('assertZodSchema should throw an error if schema is not a zod schema', () => { - expect(() => assertZodSchema(null)).toThrow() - expect(() => assertZodSchema(undefined)).toThrow() - expect(() => assertZodSchema(42)).toThrow() - expect(() => assertZodSchema('foo')).toThrow() - expect(() => assertZodSchema({})).toThrow() +test('assertsZodSchema should throw an error if schema is not a zod schema', () => { + expect(() => assertsZodSchema(null)).toThrow() + expect(() => assertsZodSchema(undefined)).toThrow() + expect(() => assertsZodSchema(42)).toThrow() + expect(() => assertsZodSchema('foo')).toThrow() + expect(() => assertsZodSchema({})).toThrow() }) -test('assertZodSchema should not throw an error if schema is a zod schema', () => { - expect(() => assertZodSchema(z.null())).not.toThrow() - expect(() => assertZodSchema(z.undefined())).not.toThrow() - expect(() => assertZodSchema(z.number())).not.toThrow() - expect(() => assertZodSchema(z.string())).not.toThrow() - expect(() => assertZodSchema(z.object({}))).not.toThrow() +test('assertsZodSchema should not throw an error if schema is a zod schema', () => { + expect(() => assertsZodSchema(z.null())).not.toThrow() + expect(() => assertsZodSchema(z.undefined())).not.toThrow() + expect(() => assertsZodSchema(z.number())).not.toThrow() + expect(() => assertsZodSchema(z.string())).not.toThrow() + expect(() => assertsZodSchema(z.object({}))).not.toThrow() }) diff --git a/tests/zod-any-faker.test.ts b/tests/zod-any-faker.test.ts index cefbe09..151fad1 100644 --- a/tests/zod-any-faker.test.ts +++ b/tests/zod-any-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodAnyFaker, ZodAnyFaker } from '../src/zod-any-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-array-faker.test.ts b/tests/zod-array-faker.test.ts index d78b362..4ce1afd 100644 --- a/tests/zod-array-faker.test.ts +++ b/tests/zod-array-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodArrayFaker, ZodArrayFaker } from '../src/zod-array-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-bigint-faker.test.ts b/tests/zod-bigint-faker.test.ts index bec43f1..530a2b0 100644 --- a/tests/zod-bigint-faker.test.ts +++ b/tests/zod-bigint-faker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodBigIntFaker, ZodBigIntFaker } from '../src/zod-bigint-faker' import { expectType, TypeEqual } from 'ts-expect' import { testMultipleTimes } from './util' diff --git a/tests/zod-boolean-faker.test.ts b/tests/zod-boolean-faker.test.ts index 90c9a12..b0240d9 100644 --- a/tests/zod-boolean-faker.test.ts +++ b/tests/zod-boolean-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodBooleanFaker, ZodBooleanFaker } from '../src/zod-boolean-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-branded.test.ts b/tests/zod-branded.test.ts index f57cde1..3345987 100644 --- a/tests/zod-branded.test.ts +++ b/tests/zod-branded.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { fake, install } from '../src' test('branded', () => { diff --git a/tests/zod-custom-faker.test.ts b/tests/zod-custom-faker.test.ts index 5c561af..bdc4047 100644 --- a/tests/zod-custom-faker.test.ts +++ b/tests/zod-custom-faker.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { fake, installCustom, ZodTypeFaker, runFake, install } from '../src' // 1/5. define custom schema diff --git a/tests/zod-date-faker.test.ts b/tests/zod-date-faker.test.ts index 291a48a..aa23591 100644 --- a/tests/zod-date-faker.test.ts +++ b/tests/zod-date-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodDateFaker, ZodDateFaker } from '../src/zod-date-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-default-faker.test.ts b/tests/zod-default-faker.test.ts index 5610053..cbf352e 100644 --- a/tests/zod-default-faker.test.ts +++ b/tests/zod-default-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodDefaultFaker, ZodDefaultFaker } from '../src/zod-default-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-discriminated-union-faker.test.ts b/tests/zod-discriminated-union-faker.test.ts index 3d92f50..6b62848 100644 --- a/tests/zod-discriminated-union-faker.test.ts +++ b/tests/zod-discriminated-union-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodDiscriminatedUnionFaker, ZodDiscriminatedUnionFaker } from '../src/zod-discriminated-union-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-effects-faker.test.ts b/tests/zod-effects-faker.test.ts index c9d480d..a64ac7a 100644 --- a/tests/zod-effects-faker.test.ts +++ b/tests/zod-effects-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test, vi } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodEffectsFaker, ZodEffectsFaker } from '../src/zod-effects-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-enum-faker.test.ts b/tests/zod-enum-faker.test.ts index 852ca37..c5c0591 100644 --- a/tests/zod-enum-faker.test.ts +++ b/tests/zod-enum-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodEnumFaker, ZodEnumFaker } from '../src/zod-enum-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-function-faker.test.ts b/tests/zod-function-faker.test.ts index a97099e..8e22147 100644 --- a/tests/zod-function-faker.test.ts +++ b/tests/zod-function-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodFunctionFaker, ZodFunctionFaker } from '../src/zod-function-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-intersection-faker.test.ts b/tests/zod-intersection-faker.test.ts index d704c34..58819fd 100644 --- a/tests/zod-intersection-faker.test.ts +++ b/tests/zod-intersection-faker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodIntersectionFaker, ZodIntersectionFaker } from '../src/zod-intersection-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-lazy-faker.test.ts b/tests/zod-lazy-faker.test.ts index d49ba60..65a1a19 100644 --- a/tests/zod-lazy-faker.test.ts +++ b/tests/zod-lazy-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodLazyFaker, ZodLazyFaker } from '../src/zod-lazy-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-literal-faker.test.ts b/tests/zod-literal-faker.test.ts index a11690f..b593cbe 100644 --- a/tests/zod-literal-faker.test.ts +++ b/tests/zod-literal-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodLiteralFaker, ZodLiteralFaker } from '../src/zod-literal-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-map-faker.test.ts b/tests/zod-map-faker.test.ts index 9ed0f5e..0d56cc4 100644 --- a/tests/zod-map-faker.test.ts +++ b/tests/zod-map-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodMapFaker, ZodMapFaker } from '../src/zod-map-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-nan-faker.test.ts b/tests/zod-nan-faker.test.ts index f1e084b..5af407b 100644 --- a/tests/zod-nan-faker.test.ts +++ b/tests/zod-nan-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNaNFaker, ZodNaNFaker } from '../src/zod-nan-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-native-enum-faker.test.ts b/tests/zod-native-enum-faker.test.ts index 6a1ef6d..9a96090 100644 --- a/tests/zod-native-enum-faker.test.ts +++ b/tests/zod-native-enum-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNativeEnumFaker, ZodNativeEnumFaker } from '../src/zod-native-enum-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-never-faker.test.ts b/tests/zod-never-faker.test.ts index d12e15a..dd2af6b 100644 --- a/tests/zod-never-faker.test.ts +++ b/tests/zod-never-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNeverFaker, ZodNeverFaker } from '../src/zod-never-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-null-faker.test.ts b/tests/zod-null-faker.test.ts index 06a9638..1ff20a9 100644 --- a/tests/zod-null-faker.test.ts +++ b/tests/zod-null-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNullFaker, ZodNullFaker } from '../src/zod-null-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-nullable-faker.test.ts b/tests/zod-nullable-faker.test.ts index e5fbd6f..de3ff0d 100644 --- a/tests/zod-nullable-faker.test.ts +++ b/tests/zod-nullable-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNullableFaker, ZodNullableFaker } from '../src/zod-nullable-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-number-faker.test.ts b/tests/zod-number-faker.test.ts index 7e6f708..9aada65 100644 --- a/tests/zod-number-faker.test.ts +++ b/tests/zod-number-faker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodNumberFaker, ZodNumberFaker } from '../src/zod-number-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-object-faker.test.ts b/tests/zod-object-faker.test.ts index d268e8c..2177463 100644 --- a/tests/zod-object-faker.test.ts +++ b/tests/zod-object-faker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodObjectFaker, ZodObjectFaker } from '../src/zod-object-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-optional-faker.test.ts b/tests/zod-optional-faker.test.ts index 7284306..3818980 100644 --- a/tests/zod-optional-faker.test.ts +++ b/tests/zod-optional-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodOptionalFaker, ZodOptionalFaker } from '../src/zod-optional-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-pipe-faker.test.ts b/tests/zod-pipe-faker.test.ts index a8d3c24..3dd7d63 100644 --- a/tests/zod-pipe-faker.test.ts +++ b/tests/zod-pipe-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { install, fake } from '../src' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-promise-faker.test.ts b/tests/zod-promise-faker.test.ts index f51e297..259ff8d 100644 --- a/tests/zod-promise-faker.test.ts +++ b/tests/zod-promise-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodPromiseFaker, ZodPromiseFaker } from '../src/zod-promise-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-readonly-faker.test.ts b/tests/zod-readonly-faker.test.ts index 346ccff..85c53b5 100644 --- a/tests/zod-readonly-faker.test.ts +++ b/tests/zod-readonly-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { install, fake } from '../src' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-record-faker.test.ts b/tests/zod-record-faker.test.ts index 1c68cea..9158158 100644 --- a/tests/zod-record-faker.test.ts +++ b/tests/zod-record-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodRecordFaker, ZodRecordFaker } from '../src/zod-record-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-set-faker.test.ts b/tests/zod-set-faker.test.ts index faf1085..ba3c3ed 100644 --- a/tests/zod-set-faker.test.ts +++ b/tests/zod-set-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodSetFaker, ZodSetFaker } from '../src/zod-set-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-string-faker.test.ts b/tests/zod-string-faker.test.ts index fe794be..e1a1b61 100644 --- a/tests/zod-string-faker.test.ts +++ b/tests/zod-string-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodStringFaker, ZodStringFaker } from '../src/zod-string-faker' import { expectType, TypeEqual } from 'ts-expect' import { testMultipleTimes } from './util' diff --git a/tests/zod-symbol-faker.test.ts b/tests/zod-symbol-faker.test.ts index 39a6a52..a8dda17 100644 --- a/tests/zod-symbol-faker.test.ts +++ b/tests/zod-symbol-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodSymbolFaker, ZodSymbolFaker } from '../src/zod-symbol-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-tuple-faker.test.ts b/tests/zod-tuple-faker.test.ts index e28bfbb..35ea3e2 100644 --- a/tests/zod-tuple-faker.test.ts +++ b/tests/zod-tuple-faker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodTupleFaker, ZodTupleFaker } from '../src/zod-tuple-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-undefined-faker.test.ts b/tests/zod-undefined-faker.test.ts index 72a01b5..00b3b39 100644 --- a/tests/zod-undefined-faker.test.ts +++ b/tests/zod-undefined-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodUndefinedFaker, ZodUndefinedFaker } from '../src/zod-undefined-faker' import { expectType, TypeEqual } from 'ts-expect' diff --git a/tests/zod-union-faker.test.ts b/tests/zod-union-faker.test.ts index a9e198a..ea797b9 100644 --- a/tests/zod-union-faker.test.ts +++ b/tests/zod-union-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodUnionFaker, ZodUnionFaker } from '../src/zod-union-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-unknown-faker.test.ts b/tests/zod-unknown-faker.test.ts index d32d1b9..7929761 100644 --- a/tests/zod-unknown-faker.test.ts +++ b/tests/zod-unknown-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodUnknownFaker, ZodUnknownFaker } from '../src/zod-unknown-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src' diff --git a/tests/zod-void-faker.test.ts b/tests/zod-void-faker.test.ts index 9e8b0c6..c568bc5 100644 --- a/tests/zod-void-faker.test.ts +++ b/tests/zod-void-faker.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import * as z from 'zod' +import { z } from 'zod' import { zodVoidFaker, ZodVoidFaker } from '../src/zod-void-faker' import { expectType, TypeEqual } from 'ts-expect' import { install } from '../src'