Home / File/ node-pg.test.mjs — drizzle-orm Source File

node-pg.test.mjs — drizzle-orm Source File

Architecture documentation for node-pg.test.mjs, a javascript file in the drizzle-orm codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210["node-pg.test.mjs"]
  e4c739b3_e11e_733a_6641_870b994a5c87["schema.mjs"]
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210 --> e4c739b3_e11e_733a_6641_870b994a5c87
  c440e00a_e318_94ac_100c_9843a182c7a4["config"]
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210 --> c440e00a_e318_94ac_100c_9843a182c7a4
  a59b228c_43d4_1772_d3df_66adbf678284["node-postgres"]
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210 --> a59b228c_43d4_1772_d3df_66adbf678284
  0d277acf_0d68_9daf_8724_642232a89719["pg"]
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210 --> 0d277acf_0d68_9daf_8724_642232a89719
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  c35e1b4f_2f44_553f_83a3_ded7ddeeb210 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style c35e1b4f_2f44_553f_83a3_ded7ddeeb210 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import 'dotenv/config';
import { drizzle } from 'drizzle-orm/node-postgres';
import pg from 'pg';
import { describe, expect } from 'vitest';
import { pg as schema } from './schema.mjs';

const Pool = pg.Pool;
const Client = pg.Client;

if (!process.env['PG_CONNECTION_STRING']) {
	throw new Error('PG_CONNECTION_STRING is not defined');
}

describe('node-pg', async (it) => {
	it('drizzle(string)', async () => {
		const db = drizzle(process.env['PG_CONNECTION_STRING']);

		await db.$client.query('SELECT 1;');

		expect(db.$client).toBeInstanceOf(Pool);
	});

	it('drizzle(string, config)', async () => {
		const db = drizzle(process.env['PG_CONNECTION_STRING'], {
			schema,
		});

		await db.$client.query('SELECT 1;');

		expect(db.$client).toBeInstanceOf(Pool);
		expect(db.query.User).not.toStrictEqual(undefined);
	});

	it('drizzle({connection: string, ...config})', async () => {
		const db = drizzle({
			connection: process.env['PG_CONNECTION_STRING'],
			schema,
		});

		await db.$client.query('SELECT 1;');

		expect(db.$client).toBeInstanceOf(Pool);
		expect(db.query.User).not.toStrictEqual(undefined);
	});

	it('drizzle({connection: params, ...config})', async () => {
		const db = drizzle({
			connection: {
				connectionString: process.env['PG_CONNECTION_STRING'],
			},
			schema,
		});

		await db.$client.query('SELECT 1;');

		expect(db.$client).toBeInstanceOf(Pool);
		expect(db.query.User).not.toStrictEqual(undefined);
	});

	it('drizzle(client)', async () => {
// ... (142 more lines)

Domain

Dependencies

Frequently Asked Questions

What does node-pg.test.mjs do?
node-pg.test.mjs is a source file in the drizzle-orm codebase, written in javascript. It belongs to the DrizzleORM domain.
What does node-pg.test.mjs depend on?
node-pg.test.mjs imports 5 module(s): config, node-postgres, pg, schema.mjs, vitest.
Where is node-pg.test.mjs in the architecture?
node-pg.test.mjs is located at integration-tests/js-tests/driver-init/module/node-pg.test.mjs (domain: DrizzleORM, directory: integration-tests/js-tests/driver-init/module).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free