Home / File/ neon-ws.test.mjs — drizzle-orm Source File

neon-ws.test.mjs — drizzle-orm Source File

Architecture documentation for neon-ws.test.mjs, a javascript file in the drizzle-orm codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  209be995_73d7_2b9b_7115_3bafd953031f["neon-ws.test.mjs"]
  e4c739b3_e11e_733a_6641_870b994a5c87["schema.mjs"]
  209be995_73d7_2b9b_7115_3bafd953031f --> e4c739b3_e11e_733a_6641_870b994a5c87
  c440e00a_e318_94ac_100c_9843a182c7a4["config"]
  209be995_73d7_2b9b_7115_3bafd953031f --> c440e00a_e318_94ac_100c_9843a182c7a4
  e9867962_df5d_03c5_8e49_973b2b1a930a["serverless"]
  209be995_73d7_2b9b_7115_3bafd953031f --> e9867962_df5d_03c5_8e49_973b2b1a930a
  47d362b3_604b_3277_92b3_550347bda1d8["neon-serverless"]
  209be995_73d7_2b9b_7115_3bafd953031f --> 47d362b3_604b_3277_92b3_550347bda1d8
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  209be995_73d7_2b9b_7115_3bafd953031f --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  29be5710_53a8_86c7_e03c_bf4a45a258fb["ws"]
  209be995_73d7_2b9b_7115_3bafd953031f --> 29be5710_53a8_86c7_e03c_bf4a45a258fb
  style 209be995_73d7_2b9b_7115_3bafd953031f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import 'dotenv/config';
import { Client, neonConfig, Pool } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';
import { describe, expect } from 'vitest';
import ws from 'ws';
import { pg as schema } from './schema.mjs';

neonConfig.webSocketConstructor = ws;

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

describe('neon-ws', async (it) => {
	it('drizzle(string)', async () => {
		const db = drizzle(
			process.env['NEON_CONNECTION_STRING'],
		);

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

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

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

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

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

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

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

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

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

		expect(db.query.User).not.toStrictEqual(undefined);
		expect(db.$client).toBeInstanceOf(Pool);
// ... (152 more lines)

Domain

Dependencies

Frequently Asked Questions

What does neon-ws.test.mjs do?
neon-ws.test.mjs is a source file in the drizzle-orm codebase, written in javascript. It belongs to the DrizzleORM domain.
What does neon-ws.test.mjs depend on?
neon-ws.test.mjs imports 6 module(s): config, neon-serverless, schema.mjs, serverless, vitest, ws.
Where is neon-ws.test.mjs in the architecture?
neon-ws.test.mjs is located at integration-tests/js-tests/driver-init/module/neon-ws.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