MCPcopy
hub / github.com/drizzle-team/drizzle-orm / tests

Function tests

integration-tests/tests/mysql/mysql-common.ts:310–6399  ·  view source on GitHub ↗
(driver?: string)

Source from the content-addressed store, hash-verified

308});
309
310export function tests(driver?: string) {
311 describe('common', () => {
312 // afterAll(async () => {
313 // await mysqlContainer?.stop().catch(console.error);
314 // });
315
316 beforeEach(async (ctx) => {
317 const { db } = ctx.mysql;
318 await db.execute(sql`drop table if exists userstest`);
319 await db.execute(sql`drop table if exists users2`);
320 await db.execute(sql`drop table if exists cities`);
321 await db.execute(sql`drop table if exists \`all_types\``);
322
323 if (driver !== 'planetscale') {
324 await db.execute(sql`drop schema if exists \`mySchema\``);
325 await db.execute(sql`create schema if not exists \`mySchema\``);
326 }
327
328 await db.execute(
329 sql`
330 create table userstest (
331 id serial primary key,
332 name text not null,
333 verified boolean not null default false,
334 jsonb json,
335 created_at timestamp not null default now()
336 )
337 `,
338 );
339
340 await db.execute(
341 sql`
342 create table users2 (
343 id serial primary key,
344 name text not null,
345 city_id int references cities(id)
346 )
347 `,
348 );
349
350 await db.execute(
351 sql`
352 create table cities (
353 id serial primary key,
354 name text not null
355 )
356 `,
357 );
358
359 if (driver !== 'planetscale') {
360 // mySchema
361 await db.execute(
362 sql`
363 create table \`mySchema\`.\`userstest\` (
364 \`id\` serial primary key,
365 \`name\` text not null,
366 \`verified\` boolean not null default false,
367 \`jsonb\` json,

Callers 2

Calls 15

sqlToQueryMethod · 0.95
sqlFunction · 0.90
mysqlTableFunction · 0.90
bigintFunction · 0.90
intFunction · 0.90
smallintFunction · 0.90
mediumintFunction · 0.90
tinyintFunction · 0.90
getTableConfigFunction · 0.90
serialFunction · 0.90
textFunction · 0.90
foreignKeyFunction · 0.90

Tested by

no test coverage detected