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

Function tests

integration-tests/tests/sqlite/sqlite-common.ts:192–3990  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190});
191
192export function tests() {
193 describe('common', () => {
194 beforeEach(async (ctx) => {
195 const { db } = ctx.sqlite;
196
197 await db.run(sql`drop table if exists ${usersTable}`);
198 await db.run(sql`drop table if exists ${users2Table}`);
199 await db.run(sql`drop table if exists ${citiesTable}`);
200 await db.run(sql`drop table if exists ${coursesTable}`);
201 await db.run(sql`drop table if exists ${courseCategoriesTable}`);
202 await db.run(sql`drop table if exists ${orders}`);
203 await db.run(sql`drop table if exists ${bigIntExample}`);
204 await db.run(sql`drop table if exists ${pkExampleTable}`);
205 await db.run(sql`drop table if exists ${conflictChainExampleTable}`);
206 await db.run(sql`drop table if exists ${allTypesTable}`);
207 await db.run(sql`drop table if exists user_notifications_insert_into`);
208 await db.run(sql`drop table if exists users_insert_into`);
209 await db.run(sql`drop table if exists notifications_insert_into`);
210
211 await db.run(sql`
212 create table ${usersTable} (
213 id integer primary key,
214 name text not null,
215 verified integer not null default 0,
216 json blob,
217 created_at integer not null default (strftime('%s', 'now'))
218 )
219 `);
220
221 await db.run(sql`
222 create table ${citiesTable} (
223 id integer primary key,
224 name text not null
225 )
226 `);
227 await db.run(sql`
228 create table ${courseCategoriesTable} (
229 id integer primary key,
230 name text not null
231 )
232 `);
233
234 await db.run(sql`
235 create table ${users2Table} (
236 id integer primary key,
237 name text not null,
238 city_id integer references ${citiesTable}(${sql.identifier(citiesTable.id.name)})
239 )
240 `);
241 await db.run(sql`
242 create table ${coursesTable} (
243 id integer primary key,
244 name text not null,
245 category_id integer references ${courseCategoriesTable}(${sql.identifier(courseCategoriesTable.id.name)})
246 )
247 `);
248 await db.run(sql`
249 create table ${orders} (

Callers 6

sql-js.test.tsFile · 0.90
libsql-ws.test.tsFile · 0.90

Calls 15

sqlFunction · 0.90
sqliteTableFunction · 0.90
textFunction · 0.90
foreignKeyFunction · 0.90
getTableConfigFunction · 0.90
primaryKeyFunction · 0.90
inArrayFunction · 0.90
notInArrayFunction · 0.90
integerFunction · 0.90
eqFunction · 0.90
aliasFunction · 0.90
sqliteTableCreatorFunction · 0.90

Tested by

no test coverage detected