import type UserModel from '../models/User.ts'; import type { GetModelTypeFromClass } from '../modules/BaseModel.ts'; import type Server from '../server.ts'; import type { ServerOptions } from '../server.ts'; /** * Server options a project can declare for the test server the shipped setup * boots. `folders` is excluded — the bootstrap resolves those itself from the * `TEST_FOLDER_*` env vars. */ export type TestServerOptions = Omit; /** * Declare `Server` options — notably the `bootHttp` hook — for the test server. * Without this, app-wide HTTP wiring that production does in `bootHttp` is * simply absent under test, so tests see the unwired behavior (a 500 where * production returns the mapped status) with nothing reporting the difference. * * Call it at module scope in the preload that imports the framework setup glue, * before any hook boots the server. */ export declare const configureTestServer: (options: TestServerOptions) => void; /** * Read the declared options and close the window for further configuration. * Called once by the test bootstrap as it constructs the `Server`. */ export declare const takeTestServerOptions: () => TestServerOptions; export declare let serverInstance: Server; export declare let defaultUser: InstanceType>; export declare let defaultAuthToken: string; export declare const setServerInstance: (serverInstanceToSet: Server) => void; export declare const setDefaultUser: (userToSet: InstanceType>) => void; export declare const setDefaultAuthToken: (tokenToSet: string) => void; export declare const getTestServerURL: (urlPart?: string) => string; /** * Await the idempotent per-file server startup used by the node:test preload. * Call this first from an application root-level `before()` hook before using * `appInstance`, models, config, or the HTTP server. */ export declare function ensureTestServerReady(): Promise; export declare const createDefaultTestUser: () => Promise> & Omit<{ _id: import("mongoose").Types.ObjectId; createdAt: NativeDate; updatedAt: NativeDate; avatar?: string | null | undefined; name?: Omit<{ _id: import("mongoose").Types.ObjectId; first?: string | null | undefined; last?: string | null | undefined; nick?: string | null | undefined; }, "_id"> | null | undefined; password?: string | null | undefined; email?: string | null | undefined; sessionTokens: import("mongoose").Types.DocumentArray<{ token?: string | null | undefined; valid?: NativeDate | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { token?: string | null | undefined; valid?: NativeDate | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; verificationTokens: import("mongoose").Types.DocumentArray<{ until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; passwordRecoveryTokens: import("mongoose").Types.DocumentArray<{ until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; permissions: import("mongoose").Types.Array; roles: import("mongoose").Types.Array; isVerified: boolean; locale: string; languages: import("mongoose").Types.Array; } & Required<{ _id: import("mongoose").Types.ObjectId; }> & { __v: number; }, "generateToken" | "getPublic" | "id" | "sendPasswordRecoveryEmail" | "sendVerificationEmail"> & import("mongoose").HydratedDocumentOverrides<{} & import("../modules/BaseModel.ts").DocFacingMethods<{ readonly generateToken: (this: import("../models/User.ts").UserAuthInstance & Pick> & Omit<{ _id: import("mongoose").Types.ObjectId; createdAt: NativeDate; updatedAt: NativeDate; avatar?: string | null | undefined; name?: Omit<{ _id: import("mongoose").Types.ObjectId; first?: string | null | undefined; last?: string | null | undefined; nick?: string | null | undefined; }, "_id"> | null | undefined; password?: string | null | undefined; email?: string | null | undefined; sessionTokens: import("mongoose").Types.DocumentArray<{ token?: string | null | undefined; valid?: NativeDate | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { token?: string | null | undefined; valid?: NativeDate | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; verificationTokens: import("mongoose").Types.DocumentArray<{ until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; passwordRecoveryTokens: import("mongoose").Types.DocumentArray<{ until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }, import("mongoose").Types.Subdocument & { until?: NativeDate | null | undefined; token?: string | null | undefined; } & { _id: import("mongoose").Types.ObjectId; }>; permissions: import("mongoose").Types.Array; roles: import("mongoose").Types.Array; isVerified: boolean; locale: string; languages: import("mongoose").Types.Array; } & Required<{ _id: import("mongoose").Types.ObjectId; }> & { __v: number; }, "id"> & import("mongoose").HydratedDocumentOverrides, '_id' | '$where' | 'isModified'>) => Promise<{ token: string; valid: Date; }>; readonly sendPasswordRecoveryEmail: (this: import("../models/User.ts").UserAuthInstance & { name?: { nick?: string | null; } | null; }, i18n: import("../services/i18n/types.ts").TI18n) => Promise; readonly sendVerificationEmail: (this: import("../models/User.ts").UserAuthInstance & { name?: { nick?: string | null; } | null; }, i18n: import("../services/i18n/types.ts").TI18n) => Promise; readonly getPublic: (this: import("../models/User.ts").UserPublicDoc) => { avatar: string | null | undefined; name: Omit<{ _id: import("mongoose").Types.ObjectId; first?: string | null | undefined; last?: string | null | undefined; nick?: string | null | undefined; }, "_id"> | null | undefined; email: string | null | undefined; id: string; isVerified: boolean; permissions: import("mongoose").Types.Array; locale: string; }; }> & { id: string; }>; token: string; }>;