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

tests() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3418d3a3_df7d_8999_e21a_2b4339e5aa45["tests()"]
  46ce8b0c_dd54_2020_c1e8_2865e4c5e575["sqlite-common.ts"]
  3418d3a3_df7d_8999_e21a_2b4339e5aa45 -->|defined in| 46ce8b0c_dd54_2020_c1e8_2865e4c5e575
  style 3418d3a3_df7d_8999_e21a_2b4339e5aa45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integration-tests/tests/sqlite/sqlite-common.ts lines 191–3963

export function tests() {
	describe('common', () => {
		beforeEach(async (ctx) => {
			const { db } = ctx.sqlite;

			await db.run(sql`drop table if exists ${usersTable}`);
			await db.run(sql`drop table if exists ${users2Table}`);
			await db.run(sql`drop table if exists ${citiesTable}`);
			await db.run(sql`drop table if exists ${coursesTable}`);
			await db.run(sql`drop table if exists ${courseCategoriesTable}`);
			await db.run(sql`drop table if exists ${orders}`);
			await db.run(sql`drop table if exists ${bigIntExample}`);
			await db.run(sql`drop table if exists ${pkExampleTable}`);
			await db.run(sql`drop table if exists ${conflictChainExampleTable}`);
			await db.run(sql`drop table if exists ${allTypesTable}`);
			await db.run(sql`drop table if exists user_notifications_insert_into`);
			await db.run(sql`drop table if exists users_insert_into`);
			await db.run(sql`drop table if exists notifications_insert_into`);

			await db.run(sql`
				create table ${usersTable} (
					id integer primary key,
					name text not null,
					verified integer not null default 0,
					json blob,
					created_at integer not null default (strftime('%s', 'now'))
				)
			`);

			await db.run(sql`
				create table ${citiesTable} (
					id integer primary key,
					name text not null
				)
			`);
			await db.run(sql`
				create table ${courseCategoriesTable} (
					id integer primary key,
					name text not null
				)
			`);

			await db.run(sql`
				create table ${users2Table} (
					id integer primary key,
					name text not null,
					city_id integer references ${citiesTable}(${sql.identifier(citiesTable.id.name)})
				)
			`);
			await db.run(sql`
				create table ${coursesTable} (
					id integer primary key,
					name text not null,
					category_id integer references ${courseCategoriesTable}(${sql.identifier(courseCategoriesTable.id.name)})
				)
			`);
			await db.run(sql`
				create table ${orders} (
					id integer primary key,
					region text not null,
					product text not null,
					amount integer not null,
					quantity integer not null
				)
			`);
			await db.run(sql`
				create table ${pkExampleTable} (
					id integer not null,
					name text not null,
					email text not null,
					primary key (id, name)
				)
			`);
			await db.run(sql`
				create table ${conflictChainExampleTable} (
					id integer not null unique,
					name text not null,
					email text not null,
					primary key (id, name)
				)
			`);

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free