diff --git a/src/main.ts b/src/main.ts index 812b087..774e002 100644 --- a/src/main.ts +++ b/src/main.ts @@ -383,6 +383,7 @@ function addObjects(db: Db, queryResults: QueryResults): void { * @returns whether given input are options for the `pgStructure` function. */ function isOptions(input?: Client | ClientConfig | string | Options): input is Options { + /* istanbul ignore next */ if (input === undefined) return false; const optionsAvailable: Required<{ [K in keyof Options]: true }> = { envPrefix: true, @@ -439,6 +440,7 @@ export async function pgStructure(client?: Client | ClientConfig | string, optio export async function pgStructure(options?: Options): Promise; export async function pgStructure(clientOrOptions?: Client | ClientConfig | string | Options, maybeOptions: Options = {}): Promise { const [maybePgClientOrConfig, options] = isOptions(clientOrOptions) ? [undefined, clientOrOptions] : [clientOrOptions, maybeOptions]; + /* istanbul ignore next */ const pgClientOrConfig = maybePgClientOrConfig ?? getEnvValues(options.envPrefix ?? "DB"); const { client, shouldCloseConnection } = await getConnectedPgClient(pgClientOrConfig); diff --git a/test/pg-structure.test.ts b/test/pg-structure.test.ts index e095c86..010abcf 100644 --- a/test/pg-structure.test.ts +++ b/test/pg-structure.test.ts @@ -83,10 +83,6 @@ describe("pgStructure()", () => { expect(db.tables.get("account").name).toEqual("account"); }); - it("should throw if it cannot connect.", async () => { - await expect(pgStructure()).rejects.toThrow(); - }); - it("should accept options as first argument and reads client config from environment variables.", async () => { process.env.DBPX_USER = "xyz-user"; process.env.DBPX_PASSWORD = "wrong-password";