Home / Function/ tests() — drizzle-orm Function Reference

tests() — drizzle-orm Function Reference

Architecture documentation for the tests() function in pg-common.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  d4e96821_5055_cb66_dd7b_f89dd0f8d0a0["tests()"]
  d133ab06_e39e_bce4_90ee_a55144ce75c2["pg-common.ts"]
  d4e96821_5055_cb66_dd7b_f89dd0f8d0a0 -->|defined in| d133ab06_e39e_bce4_90ee_a55144ce75c2
  style d4e96821_5055_cb66_dd7b_f89dd0f8d0a0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integration-tests/tests/pg/pg-common.ts lines 398–6518

export function tests() {
	describe('common', () => {
		beforeEach(async (ctx) => {
			const { db } = ctx.pg;
			await db.execute(sql`drop schema if exists public cascade`);
			await db.execute(sql`drop schema if exists ${mySchema} cascade`);
			await db.execute(sql`create schema public`);
			await db.execute(sql`create schema if not exists custom_migrations`);
			await db.execute(sql`create schema ${mySchema}`);
			// public users
			await db.execute(
				sql`
					create table users (
						id serial primary key,
						name text not null,
						verified boolean not null default false,
						jsonb jsonb,
						created_at timestamptz not null default now()
					)
				`,
			);
			// public cities
			await db.execute(
				sql`
					create table cities (
						id serial primary key,
						name text not null,
						state char(2)
					)
				`,
			);
			// public users2
			await db.execute(
				sql`
					create table users2 (
						id serial primary key,
						name text not null,
						city_id integer references cities(id)
					)
				`,
			);
			await db.execute(
				sql`
					create table course_categories (
						id serial primary key,
						name text not null
					)
				`,
			);
			await db.execute(
				sql`
					create table courses (
						id serial primary key,
						name text not null,
						category_id integer references course_categories(id)
					)
				`,
			);
			await db.execute(
				sql`
					create table orders (
						id serial primary key,
						region text not null,
						product text not null,
						amount integer not null,
						quantity integer not null
					)
				`,
			);
			await db.execute(
				sql`
					create table network_table (
						inet inet not null,
						cidr cidr not null,
						macaddr macaddr not null,
						macaddr8 macaddr8 not null
					)
				`,
			);
			await db.execute(
				sql`

Domain

Subdomains

Frequently Asked Questions

What does tests() do?
tests() is a function in the drizzle-orm codebase, defined in integration-tests/tests/pg/pg-common.ts.
Where is tests() defined?
tests() is defined in integration-tests/tests/pg/pg-common.ts at line 398.

Analyze Your Own Codebase

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

Try Supermodel Free