/opt/canhelp/node_modules/better-auth/node_modules/zod/src/v3/tests
NameSizeModeActions
all-errors.test.ts47530644editdlrm
anyunknown.test.ts6730644editdlrm
array.test.ts19390644editdlrm
async-parsing.test.ts126390644editdlrm
async-refinements.test.ts16030644editdlrm
base.test.ts7820644editdlrm
bigint.test.ts19770644editdlrm
branded.test.ts17340644editdlrm
catch.test.ts65500644editdlrm
coerce.test.ts66500644editdlrm
complex.test.ts24970644editdlrm
custom.test.ts9500644editdlrm
date.test.ts9830644editdlrm
deepmasking.test.ts52150644editdlrm
default.test.ts35270644editdlrm
description.test.ts13230644editdlrm
discriminated-unions.test.ts85370644editdlrm
enum.test.ts27370644editdlrm
error.test.ts168120644editdlrm
firstparty.test.ts23910644editdlrm
firstpartyschematypes.test.ts7880644editdlrm
function.test.ts67340644editdlrm
generics.test.ts15230644editdlrm
instanceof.test.ts11540644editdlrm
intersection.test.ts30910644editdlrm
language-server.source.ts12750644editdlrm
language-server.test.ts83180644editdlrm
literal.test.ts10630644editdlrm
map.test.ts35450644editdlrm
masking.test.ts850644editdlrm
mocker.test.ts3890644editdlrm
Mocker.ts13410644editdlrm
nan.test.ts7080644editdlrm
nativeEnum.test.ts23440644editdlrm
nullable.test.ts11720644editdlrm
number.test.ts63730644editdlrm
object-augmentation.test.ts5690644editdlrm
object-in-es5-env.test.ts7780644editdlrm
object.test.ts117600644editdlrm
optional.test.ts12220644editdlrm
parser.test.ts11250644editdlrm
parseUtil.test.ts8690644editdlrm
partials.test.ts69960644editdlrm
pickomit.test.ts36220644editdlrm
pipeline.test.ts8230644editdlrm
preprocess.test.ts45300644editdlrm
primitive.test.ts122150644editdlrm
promise.test.ts24900644editdlrm
readonly.test.ts73390644editdlrm
record.test.ts37350644editdlrm
recursive.test.ts39460644editdlrm
refine.test.ts81720644editdlrm
safeparse.test.ts6280644editdlrm
set.test.ts47880644editdlrm
standard-schema.test.ts25870644editdlrm
string.test.ts656330644editdlrm
transformer.test.ts56870644editdlrm
tuple.test.ts26910644editdlrm
unions.test.ts15400644editdlrm
validations.test.ts38260644editdlrm
void.test.ts3490644editdlrm
Edit: /opt/canhelp/node_modules/better-auth/node_modules/zod/src/v3/tests/language-server.test.ts (8318B)
import { test } from "vitest"; // import path from "path"; // import { Node, Project, SyntaxKind } from "ts-morph"; // import { filePath } from "./language-server.source"; // The following tool is helpful for understanding the TypeScript AST associated with these tests: // https://ts-ast-viewer.com/ (just copy the contents of language-server.source into the viewer) test("", () => {}); // describe("Executing Go To Definition (and therefore Find Usages and Rename Refactoring) using an IDE works on inferred object properties", () => { // // Compile file developmentEnvironment.source // const project = new Project({ // tsConfigFilePath: path.join(__dirname, "..", "..", "tsconfig.json"), // skipAddingFilesFromTsConfig: true, // }); // const sourceFile = project.addSourceFileAtPath(filePath); // test("works for object properties inferred from z.object()", () => { // // Find usage of Test.f1 property // const instanceVariable = // sourceFile.getVariableDeclarationOrThrow("instanceOfTest"); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f1" // ); // // Find definition of Test.f1 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of Test // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // expect(parentOfProperty?.getName()).toEqual("Test"); // }); // // test("works for first object properties inferred from z.object().merge()", () => { // // // Find usage of TestMerge.f1 property // // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( // // "instanceOfTestMerge" // // ); // // const propertyBeingAssigned = getPropertyBeingAssigned( // // instanceVariable, // // "f1" // // ); // // // Find definition of TestMerge.f1 property // // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // // SyntaxKind.VariableDeclaration // // ); // // // Assert that find definition returned the Zod definition of Test // // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // // expect(parentOfProperty?.getName()).toEqual("Test"); // // }); // // test("works for second object properties inferred from z.object().merge()", () => { // // // Find usage of TestMerge.f2 property // // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( // // "instanceOfTestMerge" // // ); // // const propertyBeingAssigned = getPropertyBeingAssigned( // // instanceVariable, // // "f2" // // ); // // // Find definition of TestMerge.f2 property // // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // // SyntaxKind.VariableDeclaration // // ); // // // Assert that find definition returned the Zod definition of TestMerge // // expect(definitionOfProperty?.getText()).toEqual( // // "f2: z.string().optional()" // // ); // // expect(parentOfProperty?.getName()).toEqual("TestMerge"); // // }); // test("works for first object properties inferred from z.union()", () => { // // Find usage of TestUnion.f1 property // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( // "instanceOfTestUnion" // ); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f1" // ); // // Find definition of TestUnion.f1 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of Test // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // expect(parentOfProperty?.getName()).toEqual("Test"); // }); // test("works for second object properties inferred from z.union()", () => { // // Find usage of TestUnion.f2 property // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( // "instanceOfTestUnion" // ); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f2" // ); // // Find definition of TestUnion.f2 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of TestUnion // expect(definitionOfProperty?.getText()).toEqual( // "f2: z.string().optional()" // ); // expect(parentOfProperty?.getName()).toEqual("TestUnion"); // }); // test("works for object properties inferred from z.object().partial()", () => { // // Find usage of TestPartial.f1 property // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( // "instanceOfTestPartial" // ); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f1" // ); // // Find definition of TestPartial.f1 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of Test // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // expect(parentOfProperty?.getName()).toEqual("Test"); // }); // test("works for object properties inferred from z.object().pick()", () => { // // Find usage of TestPick.f1 property // const instanceVariable = // sourceFile.getVariableDeclarationOrThrow("instanceOfTestPick"); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f1" // ); // // Find definition of TestPick.f1 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of Test // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // expect(parentOfProperty?.getName()).toEqual("Test"); // }); // test("works for object properties inferred from z.object().omit()", () => { // // Find usage of TestOmit.f1 property // const instanceVariable = // sourceFile.getVariableDeclarationOrThrow("instanceOfTestOmit"); // const propertyBeingAssigned = getPropertyBeingAssigned( // instanceVariable, // "f1" // ); // // Find definition of TestOmit.f1 property // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( // SyntaxKind.VariableDeclaration // ); // // Assert that find definition returned the Zod definition of Test // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); // expect(parentOfProperty?.getName()).toEqual("Test"); // }); // }); // const getPropertyBeingAssigned = (node: Node, name: string) => { // const propertyAssignment = node.forEachDescendant((descendent) => // Node.isPropertyAssignment(descendent) && descendent.getName() == name // ? descendent // : undefined // ); // if (propertyAssignment == null) // fail(`Could not find property assignment with name ${name}`); // const propertyLiteral = propertyAssignment.getFirstDescendantByKind( // SyntaxKind.Identifier // ); // if (propertyLiteral == null) // fail(`Could not find property literal with name ${name}`); // return propertyLiteral; // };