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

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

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

File javascript 1 imports

Entity Profile

Dependency Diagram

graph LR
  4f866ada_25be_8f8a_4b39_689d6774adb4["neon-ws.test.cjs"]
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  4f866ada_25be_8f8a_4b39_689d6774adb4 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 4f866ada_25be_8f8a_4b39_689d6774adb4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

require('dotenv/config');
const { neonConfig, Pool, Client } = require('@neondatabase/serverless');
const { drizzle } = require('drizzle-orm/neon-serverless');
const { pg: schema } = require('./schema.cjs');
const ws = require('ws');
import { describe, expect } from 'vitest';

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)

Dependencies

  • vitest

Frequently Asked Questions

What does neon-ws.test.cjs do?
neon-ws.test.cjs is a source file in the drizzle-orm codebase, written in javascript.
What does neon-ws.test.cjs depend on?
neon-ws.test.cjs imports 1 module(s): vitest.
Where is neon-ws.test.cjs in the architecture?
neon-ws.test.cjs is located at integration-tests/js-tests/driver-init/commonjs/neon-ws.test.cjs (directory: integration-tests/js-tests/driver-init/commonjs).

Analyze Your Own Codebase

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

Try Supermodel Free