(driver?: string)
| 299 | } |
| 300 | |
| 301 | export function tests(driver?: string) { |
| 302 | describe('common', () => { |
| 303 | afterAll(async () => { |
| 304 | await singlestoreContainer?.stop().catch(console.error); |
| 305 | }); |
| 306 | |
| 307 | beforeEach(async (ctx) => { |
| 308 | const { db } = ctx.singlestore; |
| 309 | await db.execute(sql`drop table if exists userstest`); |
| 310 | await db.execute(sql`drop table if exists users2`); |
| 311 | await db.execute(sql`drop table if exists cities`); |
| 312 | await db.execute(sql`drop table if exists ${allTypesTable}`); |
| 313 | |
| 314 | await db.execute(sql`drop schema if exists \`mySchema\``); |
| 315 | await db.execute(sql`create schema if not exists \`mySchema\``); |
| 316 | |
| 317 | await db.execute( |
| 318 | sql` |
| 319 | create table userstest ( |
| 320 | id serial primary key, |
| 321 | name text not null, |
| 322 | verified boolean not null default false, |
| 323 | jsonb json, |
| 324 | created_at timestamp not null default now() |
| 325 | ) |
| 326 | `, |
| 327 | ); |
| 328 | |
| 329 | await db.execute( |
| 330 | sql` |
| 331 | create table users2 ( |
| 332 | id serial primary key, |
| 333 | name text not null, |
| 334 | city_id int |
| 335 | ) |
| 336 | `, |
| 337 | ); |
| 338 | |
| 339 | await db.execute( |
| 340 | sql` |
| 341 | create table cities ( |
| 342 | id serial primary key, |
| 343 | name text not null |
| 344 | ) |
| 345 | `, |
| 346 | ); |
| 347 | |
| 348 | // mySchema |
| 349 | await db.execute( |
| 350 | sql` |
| 351 | create table \`mySchema\`.\`userstest\` ( |
| 352 | \`id\` serial primary key, |
| 353 | \`name\` text not null, |
| 354 | \`verified\` boolean not null default false, |
| 355 | \`jsonb\` json, |
| 356 | \`created_at\` timestamp not null default now() |
| 357 | ) |
| 358 | `, |
no test coverage detected