@@ -3,7 +3,7 @@ import { describe, expect, expectTypeOf, it, test } from 'vitest';
33import { z as z3 } from 'zod/v3' ;
44import { z as z4 } from 'zod/v4' ;
55
6- import { isZodTypeLike , isZodV3Type } from '../zod4.js' ;
6+ import { isZodType , isZodTypeLike } from '../zod4.js' ;
77
88import type {
99 ZodErrorLike ,
@@ -71,28 +71,28 @@ describe('isZodTypeLike', () => {
7171 } ) ;
7272} ) ;
7373
74- describe ( 'isZodV3Type ' , ( ) => {
74+ describe ( 'isZodType ' , ( ) => {
7575 // since we use require here, the prototype chain in the cjs module will be different than the esm build
7676 const { z : z3_2 } = require ( 'zod/v3' ) as typeof import ( 'zod/v3' ) ;
7777
7878 it ( 'should return true for an instance of ZodNumber' , ( ) => {
79- expect ( isZodV3Type ( z3 . number ( ) ) ) . toBe ( true ) ;
79+ expect ( isZodType ( z3 . number ( ) , { version : 3 } ) ) . toBe ( true ) ;
8080 } ) ;
8181 it ( 'should return true for an instance of ZodObject' , ( ) => {
82- expect ( isZodV3Type ( z3 . object ( { } ) ) ) . toBe ( true ) ;
82+ expect ( isZodType ( z3 . object ( { } ) , { version : 3 } ) ) . toBe ( true ) ;
8383 } ) ;
8484 it ( 'should return false for null' , ( ) => {
85- expect ( isZodV3Type ( null ) ) . toBe ( false ) ;
85+ expect ( isZodType ( null , { version : 3 } ) ) . toBe ( false ) ;
8686 } ) ;
8787 it ( 'should return false for any empty object' , ( ) => {
88- expect ( isZodV3Type ( { } ) ) . toBe ( false ) ;
88+ expect ( isZodType ( { } , { version : 3 } ) ) . toBe ( false ) ;
8989 } ) ;
9090 it ( 'should return false for an object with a null prototype' , ( ) => {
91- expect ( isZodV3Type ( Object . create ( null ) ) ) . toBe ( false ) ;
91+ expect ( isZodType ( Object . create ( null ) , { version : 3 } ) ) . toBe ( false ) ;
9292 } ) ;
9393 it ( 'should return true for a ZodObject created in a different context' , ( ) => {
9494 const input = z3_2 . object ( { } ) ;
9595 expect ( input ) . not . toBeInstanceOf ( z3 . ZodType ) ;
96- expect ( isZodV3Type ( input ) ) . toBe ( true ) ;
96+ expect ( isZodType ( input , { version : 3 } ) ) . toBe ( true ) ;
9797 } ) ;
9898} ) ;
0 commit comments