@proteinjs/db 1.0.28 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/CrudTests.ts CHANGED
@@ -13,7 +13,7 @@ export interface Employee extends Record {
13
13
  object?: string;
14
14
  }
15
15
 
16
- export class EmployeeTable extends Table<Employee> {
16
+ export class EmployeeTestTable extends Table<Employee> {
17
17
  name = 'db_test_employee';
18
18
  columns = withRecordColumns<Employee>({
19
19
  name: new StringColumn('name'),
@@ -25,13 +25,35 @@ export class EmployeeTable extends Table<Employee> {
25
25
  });
26
26
  }
27
27
 
28
+ export interface ReservedWordTest extends Record {
29
+ name: string;
30
+ order?: string;
31
+ select?: string;
32
+ join?: string;
33
+ }
34
+
35
+ export class ReservedWordTestTable extends Table<ReservedWordTest> {
36
+ name = 'db_test_reserved_word';
37
+ columns = withRecordColumns<ReservedWordTest>({
38
+ name: new StringColumn('name'),
39
+ order: new StringColumn('order'),
40
+ select: new StringColumn('select'),
41
+ join: new StringColumn('join'),
42
+ });
43
+ }
44
+
28
45
  /**
29
46
  * Used for testing purposes only.
30
47
  * */
31
- export const getTestTable = (tableName: string) => {
32
- const employeeTable = new EmployeeTable();
48
+ export const getCrudTestTable = (tableName: string) => {
49
+ const employeeTable = new EmployeeTestTable();
33
50
  if (employeeTable.name == tableName) {
34
- return new EmployeeTable();
51
+ return new EmployeeTestTable();
52
+ }
53
+
54
+ const reservedWordTestTable = new ReservedWordTestTable();
55
+ if (reservedWordTestTable.name == tableName) {
56
+ return new ReservedWordTestTable();
35
57
  }
36
58
 
37
59
  throw new Error(`Cannot find test table: ${tableName}`);
@@ -39,18 +61,20 @@ export const getTestTable = (tableName: string) => {
39
61
 
40
62
  export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Promise<void>) => {
41
63
  return () => {
42
- const db = new Db(driver, getTestTable);
64
+ const db = new Db(driver, getCrudTestTable);
43
65
 
44
66
  beforeAll(async () => {
45
67
  if (driver.start) {
46
68
  await driver.start();
47
69
  }
48
70
 
49
- await driver.getTableManager().loadTable(new EmployeeTable());
71
+ await driver.getTableManager().loadTable(new EmployeeTestTable());
72
+ await driver.getTableManager().loadTable(new ReservedWordTestTable());
50
73
  });
51
74
 
52
75
  afterAll(async () => {
53
- await dropTable(new EmployeeTable());
76
+ await dropTable(new EmployeeTestTable());
77
+ await dropTable(new ReservedWordTestTable());
54
78
 
55
79
  if (driver.stop) {
56
80
  await driver.stop();
@@ -59,7 +83,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
59
83
 
60
84
  test('Insert', async () => {
61
85
  const testEmployee: Omit<Employee, keyof Record> = { name: 'Veronica' };
62
- const emplyeeTable: Table<Employee> = new EmployeeTable();
86
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
63
87
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
64
88
  const fetchedEmployee = await db.get(emplyeeTable, { id: insertedEmployee.id });
65
89
  expect(fetchedEmployee).toBeTruthy();
@@ -68,7 +92,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
68
92
 
69
93
  test('Update', async () => {
70
94
  const testEmployee: Omit<Employee, keyof Record> = { name: 'Veronica' };
71
- const emplyeeTable: Table<Employee> = new EmployeeTable();
95
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
72
96
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
73
97
  const updateCount = await db.update(
74
98
  emplyeeTable,
@@ -89,7 +113,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
89
113
 
90
114
  test('Delete', async () => {
91
115
  const testEmployee: Omit<Employee, keyof Record> = { name: 'Veronica' };
92
- const emplyeeTable: Table<Employee> = new EmployeeTable();
116
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
93
117
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
94
118
  let fetchedEmployee = await db.get(emplyeeTable, { id: insertedEmployee.id });
95
119
  expect(fetchedEmployee).toBeTruthy();
@@ -103,7 +127,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
103
127
  const testEmployee1: Omit<Employee, keyof Record> = { name: 'Veronica', department: 'Cake Factory' };
104
128
  const testEmployee2: Omit<Employee, keyof Record> = { name: 'Brent', department: 'Cake Factory' };
105
129
  const testEmployee3: Omit<Employee, keyof Record> = { name: 'Sean', department: 'Pug Playhouse' };
106
- const emplyeeTable: Table<Employee> = new EmployeeTable();
130
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
107
131
  const fetchedEmployee1 = await db.insert(emplyeeTable, testEmployee1);
108
132
  const fetchedEmployee2 = await db.insert(emplyeeTable, testEmployee2);
109
133
  const fetchedEmployee3 = await db.insert(emplyeeTable, testEmployee3);
@@ -123,7 +147,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
123
147
  const testEmployee1: Omit<Employee, keyof Record> = { name: 'Veronica', department: 'Cake Factory' };
124
148
  const testEmployee2: Omit<Employee, keyof Record> = { name: 'Brent', department: 'Cake Factory' };
125
149
  const testEmployee3: Omit<Employee, keyof Record> = { name: 'Sean', department: 'Pug Playhouse' };
126
- const emplyeeTable: Table<Employee> = new EmployeeTable();
150
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
127
151
  const fetchedEmployee1 = await db.insert(emplyeeTable, testEmployee1);
128
152
  const fetchedEmployee2 = await db.insert(emplyeeTable, testEmployee2);
129
153
  const fetchedEmployee3 = await db.insert(emplyeeTable, testEmployee3);
@@ -144,7 +168,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
144
168
  jobTitle: null,
145
169
  isRemote: false,
146
170
  };
147
- const emplyeeTable: Table<Employee> = new EmployeeTable();
171
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
148
172
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
149
173
  const fetchedEmployee = await db.get(emplyeeTable, { id: insertedEmployee.id });
150
174
 
@@ -160,7 +184,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
160
184
  jobTitle: 'Cowboy',
161
185
  isRemote: false,
162
186
  };
163
- const emplyeeTable: Table<Employee> = new EmployeeTable();
187
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
164
188
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
165
189
  const fetchedEmployee = await db.get(emplyeeTable, { id: insertedEmployee.id });
166
190
  expect(fetchedEmployee).toBeTruthy();
@@ -176,7 +200,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
176
200
  jobTitle: null,
177
201
  isRemote: false,
178
202
  };
179
- const emplyeeTable: Table<Employee> = new EmployeeTable();
203
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
180
204
  const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
181
205
 
182
206
  const qb = new QueryBuilder<Employee>(emplyeeTable.name)
@@ -194,7 +218,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
194
218
  const testEmployee1: Omit<Employee, keyof Record> = { name: 'Veronica', jobTitle: 'Engineer' };
195
219
  const testEmployee2: Omit<Employee, keyof Record> = { name: 'Zenyatta', jobTitle: null };
196
220
  const testEmployee3: Omit<Employee, keyof Record> = { name: 'Cassidy', jobTitle: 'Cowboy' };
197
- const emplyeeTable: Table<Employee> = new EmployeeTable();
221
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
198
222
  const insertedEmployee1 = await db.insert(emplyeeTable, testEmployee1);
199
223
  const insertedEmployee2 = await db.insert(emplyeeTable, testEmployee2);
200
224
  const insertedEmployee3 = await db.insert(emplyeeTable, testEmployee3);
@@ -241,29 +265,29 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
241
265
  jobTitle: 'Cowboy',
242
266
  startDate: new Date('2016-05-24T00:00:00Z'),
243
267
  };
244
- const employeeTable: Table<Employee> = new EmployeeTable();
268
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
245
269
 
246
- const insertedEmployee1 = await db.insert(employeeTable, testEmployee1);
247
- const insertedEmployee2 = await db.insert(employeeTable, testEmployee2);
248
- const insertedEmployee3 = await db.insert(employeeTable, testEmployee3);
270
+ const insertedEmployee1 = await db.insert(emplyeeTable, testEmployee1);
271
+ const insertedEmployee2 = await db.insert(emplyeeTable, testEmployee2);
272
+ const insertedEmployee3 = await db.insert(emplyeeTable, testEmployee3);
249
273
 
250
- const betweenQuery = new QueryBuilder<Employee>(employeeTable.name).condition({
274
+ const betweenQuery = new QueryBuilder<Employee>(emplyeeTable.name).condition({
251
275
  field: 'startDate',
252
276
  operator: 'BETWEEN',
253
277
  value: ['2000-06-05T00:00:00Z', '2024-06-05T00:00:00Z'],
254
278
  });
255
- const betweenResults = await db.query(employeeTable, betweenQuery);
279
+ const betweenResults = await db.query(emplyeeTable, betweenQuery);
256
280
  expect(betweenResults.length).toBe(2);
257
281
  expect(betweenResults.some((emp) => emp.name === 'Kiriko')).toBe(true);
258
282
  expect(betweenResults.some((emp) => emp.name === 'Cassidy')).toBe(true);
259
283
 
260
284
  // Clean up
261
- const qb = new QueryBuilder<Employee>(employeeTable.name).condition({
285
+ const qb = new QueryBuilder<Employee>(emplyeeTable.name).condition({
262
286
  field: 'id',
263
287
  operator: 'IN',
264
288
  value: [insertedEmployee1.id, insertedEmployee2.id, insertedEmployee3.id],
265
289
  });
266
- await db.delete(employeeTable, qb);
290
+ await db.delete(emplyeeTable, qb);
267
291
  });
268
292
 
269
293
  test('Query with sort', async () => {
@@ -279,7 +303,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
279
303
  name: 'Cassidy',
280
304
  jobTitle: 'Cowboy',
281
305
  };
282
- const emplyeeTable: Table<Employee> = new EmployeeTable();
306
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
283
307
 
284
308
  const insertedEmployee1 = await db.insert(emplyeeTable, testEmployee1);
285
309
  const insertedEmployee2 = await db.insert(emplyeeTable, testEmployee2);
@@ -308,7 +332,7 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
308
332
  test('CRUD operations with undefined values', async () => {
309
333
  const testEmployee1: Omit<Employee, keyof Record> = { name: 'Veronica', jobTitle: 'Software Engineer' };
310
334
  const testEmployee2: Omit<Employee, keyof Record> = { name: 'Brent', jobTitle: undefined };
311
- const emplyeeTable: Table<Employee> = new EmployeeTable();
335
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
312
336
 
313
337
  // Insert operation with undefined values
314
338
  await expect(db.insert(emplyeeTable, testEmployee2)).rejects.toThrow();
@@ -338,5 +362,160 @@ export const crudTests = (driver: DbDriver, dropTable: (table: Table<any>) => Pr
338
362
  });
339
363
  await db.delete(emplyeeTable, deleteValidQuery);
340
364
  });
365
+
366
+ test('Insert with reserved words', async () => {
367
+ const testRecord: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name', order: '1', select: 'Option 1' };
368
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
369
+ const insertedRecord = await db.insert(table, testRecord);
370
+ const fetchedRecord = await db.get(table, { id: insertedRecord.id });
371
+ expect(fetchedRecord).toBeTruthy();
372
+ await db.delete(table, { id: fetchedRecord.id });
373
+ });
374
+
375
+ test('Update with reserved words', async () => {
376
+ const testRecord: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name', order: '1', select: 'Option 1' };
377
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
378
+ const insertedRecord = await db.insert(table, testRecord);
379
+ const updateCount = await db.update(
380
+ table,
381
+ {
382
+ name: 'Updated Name',
383
+ order: '2',
384
+ join: 'Join Option',
385
+ },
386
+ { id: insertedRecord.id }
387
+ );
388
+ expect(updateCount).toBe(1);
389
+ const fetchedRecord = await db.get(table, { id: insertedRecord.id });
390
+ expect(fetchedRecord.name).toBe('Updated Name');
391
+ expect(fetchedRecord.order).toBe('2');
392
+ expect(fetchedRecord.join).toBe('Join Option');
393
+ await db.delete(table, { id: fetchedRecord.id });
394
+ });
395
+
396
+ test('Delete with reserved words', async () => {
397
+ const testRecord: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name', order: '1', select: 'Option 1' };
398
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
399
+ const insertedRecord = await db.insert(table, testRecord);
400
+ let fetchedRecord = await db.get(table, { id: insertedRecord.id });
401
+ expect(fetchedRecord).toBeTruthy();
402
+ const deleteCount = await db.delete(table, { id: fetchedRecord.id });
403
+ expect(deleteCount).toBe(1);
404
+ fetchedRecord = await db.get(table, { id: insertedRecord.id });
405
+ expect(fetchedRecord).toBeFalsy();
406
+ });
407
+
408
+ test('Query with reserved words', async () => {
409
+ const testRecord1: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 1', order: '1', select: 'Option 1' };
410
+ const testRecord2: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 2', order: '1', select: 'Option 1' };
411
+ const testRecord3: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 3', order: '2', select: 'Option 2' };
412
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
413
+ const insertedRecord1 = await db.insert(table, testRecord1);
414
+ const insertedRecord2 = await db.insert(table, testRecord2);
415
+ const insertedRecord3 = await db.insert(table, testRecord3);
416
+ const fetchedRecords = await db.query(table, { order: '1', select: 'Option 1' });
417
+ expect(fetchedRecords.length).toBe(2);
418
+ expect(fetchedRecords[0].name).toBe('Test Name 1');
419
+ expect(fetchedRecords[1].name).toBe('Test Name 2');
420
+ const qb = new QueryBuilder<ReservedWordTest>(table.name).condition({
421
+ field: 'id',
422
+ operator: 'IN',
423
+ value: [insertedRecord1.id, insertedRecord2.id, insertedRecord3.id],
424
+ });
425
+ await db.delete(table, qb);
426
+ });
427
+
428
+ test('Query with sort and reserved words', async () => {
429
+ const testRecord1: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 1', order: '1', select: 'Option 1' };
430
+ const testRecord2: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 2', order: '2', select: 'Option 2' };
431
+ const testRecord3: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 3', order: '3', select: 'Option 3' };
432
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
433
+
434
+ const insertedRecord1 = await db.insert(table, testRecord1);
435
+ const insertedRecord2 = await db.insert(table, testRecord2);
436
+ const insertedRecord3 = await db.insert(table, testRecord3);
437
+
438
+ const sortQuery = new QueryBuilder<ReservedWordTest>(table.name).sort([
439
+ { field: 'order', byValues: ['1', '2', '3'] },
440
+ ]);
441
+ const sortResults = await db.query(table, sortQuery);
442
+
443
+ // Assertions
444
+ expect(sortResults.length).toBe(3);
445
+ expect(sortResults[0].order).toBe('1');
446
+ expect(sortResults[1].order).toBe('2');
447
+ expect(sortResults[2].order).toBe('3');
448
+
449
+ // Clean up
450
+ const qb = new QueryBuilder<ReservedWordTest>(table.name).condition({
451
+ field: 'id',
452
+ operator: 'IN',
453
+ value: [insertedRecord1.id, insertedRecord2.id, insertedRecord3.id],
454
+ });
455
+ await db.delete(table, qb);
456
+ });
457
+
458
+ test('Query with reserved words and subquery', async () => {
459
+ const testRecord1: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 1', order: '1', select: 'Option 1' };
460
+ const testRecord2: Omit<ReservedWordTest, keyof Record> = { name: 'Test Name 2', order: '2', select: 'Option 2' };
461
+ const table: Table<ReservedWordTest> = new ReservedWordTestTable();
462
+
463
+ const insertedRecord1 = await db.insert(table, testRecord1);
464
+ const insertedRecord2 = await db.insert(table, testRecord2);
465
+
466
+ const subQb = new QueryBuilder<ReservedWordTest>(table.name).select({ fields: ['id'] }).condition({
467
+ field: 'select',
468
+ operator: '=',
469
+ value: 'Option 1',
470
+ });
471
+
472
+ const qb = new QueryBuilder<ReservedWordTest>(table.name).condition({
473
+ field: 'id',
474
+ operator: 'IN',
475
+ value: subQb,
476
+ });
477
+
478
+ // Execute the query
479
+ const results = await db.query(table, qb);
480
+ expect(results.length).toBe(1);
481
+ expect(results[0].name).toBe('Test Name 1');
482
+
483
+ // Clean up
484
+ await db.delete(table, { id: insertedRecord1.id });
485
+ await db.delete(table, { id: insertedRecord2.id });
486
+ }, 10000);
487
+
488
+ test('Case sensitivity', async () => {
489
+ const testEmployee: Omit<Employee, keyof Record> = {
490
+ name: 'Veronica',
491
+ jobTitle: 'Software ENGINEER',
492
+ isRemote: true,
493
+ startDate: new Date('2024-04-01T00:00:00Z'),
494
+ };
495
+ const emplyeeTable: Table<Employee> = new EmployeeTestTable();
496
+ const insertedEmployee = await db.insert(emplyeeTable, testEmployee);
497
+
498
+ const queryNameInsensitive = new QueryBuilder<Employee>(emplyeeTable.name).condition(
499
+ {
500
+ field: 'jobTitle',
501
+ operator: '=',
502
+ value: 'SOFTWARE engineer',
503
+ },
504
+ undefined,
505
+ false
506
+ );
507
+ const nameResultsIns = await db.query(emplyeeTable, queryNameInsensitive);
508
+ expect(nameResultsIns.length).toBe(1);
509
+
510
+ const queryNameSensitive = new QueryBuilder<Employee>(emplyeeTable.name).condition({
511
+ field: 'jobTitle',
512
+ operator: '=',
513
+ value: 'SOFTWARE ENGINEER',
514
+ });
515
+ const nameResultsSens = await db.query(emplyeeTable, queryNameSensitive);
516
+ expect(nameResultsSens.length).toBe(0);
517
+
518
+ await db.delete(emplyeeTable, { id: insertedEmployee.id });
519
+ });
341
520
  };
342
521
  };
@@ -20,7 +20,7 @@ interface User extends Record {
20
20
  active: boolean;
21
21
  }
22
22
 
23
- class UserTable extends Table<User> {
23
+ class UserTestTable extends Table<User> {
24
24
  name = 'db_test_user';
25
25
  columns = withRecordColumns<User>({
26
26
  name: new StringColumn('name'),
@@ -87,7 +87,7 @@ export const tableManagerTests = (
87
87
 
88
88
  afterEach(async () => {
89
89
  await dropTable(new ColumnTypesTable());
90
- await dropTable(new UserTable());
90
+ await dropTable(new UserTestTable());
91
91
  });
92
92
 
93
93
  afterAll(async () => {
@@ -97,7 +97,7 @@ export const tableManagerTests = (
97
97
  });
98
98
 
99
99
  test('create primary key', async () => {
100
- const userTable = new UserTable();
100
+ const userTable = new UserTestTable();
101
101
  await tableManager.loadTable(userTable);
102
102
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
103
103
  const primaryKey = await tableManager.schemaMetadata.getPrimaryKey(userTable);
@@ -106,7 +106,7 @@ export const tableManagerTests = (
106
106
  });
107
107
 
108
108
  test('create columns', async () => {
109
- const userTable = new UserTable();
109
+ const userTable = new UserTestTable();
110
110
  await tableManager.loadTable(userTable);
111
111
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
112
112
  expect(await tableManager.schemaMetadata.columnExists(userTable.columns.name.name, userTable)).toBeTruthy();
@@ -115,7 +115,7 @@ export const tableManagerTests = (
115
115
  });
116
116
 
117
117
  test('add column via alter', async () => {
118
- const userTable = new UserTable();
118
+ const userTable = new UserTestTable();
119
119
  const dataColumn = new ObjectColumn('data');
120
120
  await tableManager.loadTable(userTable);
121
121
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
@@ -133,7 +133,7 @@ export const tableManagerTests = (
133
133
  });
134
134
 
135
135
  test('columns created with correct types', async () => {
136
- const userTable = new UserTable();
136
+ const userTable = new UserTestTable();
137
137
  const columnTypesTable = new ColumnTypesTable();
138
138
  await tableManager.loadTable(userTable);
139
139
  await tableManager.loadTable(columnTypesTable);
@@ -178,7 +178,7 @@ export const tableManagerTests = (
178
178
  });
179
179
 
180
180
  test('columns created with correct options', async () => {
181
- const userTable = new UserTable();
181
+ const userTable = new UserTestTable();
182
182
  const columnTypesTable = new ColumnTypesTable();
183
183
  await tableManager.loadTable(userTable);
184
184
  await tableManager.loadTable(columnTypesTable);
@@ -203,7 +203,7 @@ export const tableManagerTests = (
203
203
  return;
204
204
  }
205
205
 
206
- const userTable = new UserTable();
206
+ const userTable = new UserTestTable();
207
207
  await tableManager.loadTable(userTable);
208
208
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
209
209
  expect(await tableManager.schemaMetadata.columnExists(userTable.columns.name.name, userTable)).toBeTruthy();
@@ -219,7 +219,7 @@ export const tableManagerTests = (
219
219
  return;
220
220
  }
221
221
 
222
- const userTable = new UserTable();
222
+ const userTable = new UserTestTable();
223
223
  const columnTypesTable = new ColumnTypesTable();
224
224
  await tableManager.loadTable(userTable);
225
225
  await tableManager.loadTable(columnTypesTable);
@@ -287,7 +287,7 @@ export const tableManagerTests = (
287
287
  });
288
288
 
289
289
  test('alter unique constraint', async () => {
290
- const userTable = new UserTable();
290
+ const userTable = new UserTestTable();
291
291
  const columnTypesTable = new ColumnTypesTable();
292
292
  await tableManager.loadTable(userTable);
293
293
  columnTypesTable.columns.text.options = { defaultValue: async () => 'asdf' };
@@ -409,7 +409,7 @@ export const tableManagerTests = (
409
409
  return;
410
410
  }
411
411
 
412
- const userTable = new UserTable();
412
+ const userTable = new UserTestTable();
413
413
  const columnTypesTable = new ColumnTypesTable();
414
414
  await tableManager.loadTable(userTable);
415
415
  columnTypesTable.columns.text.options = { defaultValue: async () => 'asdf' };
@@ -528,7 +528,7 @@ export const tableManagerTests = (
528
528
  });
529
529
 
530
530
  test('create index', async () => {
531
- const userTable = new UserTable();
531
+ const userTable = new UserTestTable();
532
532
  await tableManager.loadTable(userTable);
533
533
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
534
534
  const indexes = await tableManager.schemaMetadata.getIndexes(userTable);
@@ -537,7 +537,7 @@ export const tableManagerTests = (
537
537
  });
538
538
 
539
539
  test('alter index', async () => {
540
- const userTable = new UserTable();
540
+ const userTable = new UserTestTable();
541
541
  await tableManager.loadTable(userTable);
542
542
  expect(await tableManager.tableExists(userTable)).toBeTruthy();
543
543
  let indexes = await tableManager.schemaMetadata.getIndexes(userTable);