()
| 190 | }); |
| 191 | |
| 192 | export 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} ( |
no test coverage detected