@naturalcycles/db-lib 10.0.0 → 10.0.2

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.
Files changed (90) hide show
  1. package/dist/adapter/cachedb/cache.db.d.ts +6 -6
  2. package/dist/adapter/cachedb/cache.db.js +6 -5
  3. package/dist/adapter/cachedb/cache.db.model.d.ts +3 -3
  4. package/dist/adapter/cachedb/index.d.ts +1 -1
  5. package/dist/adapter/file/file.db.d.ts +8 -7
  6. package/dist/adapter/file/file.db.js +11 -10
  7. package/dist/adapter/file/file.db.model.d.ts +2 -2
  8. package/dist/adapter/file/inMemory.persistence.plugin.d.ts +3 -3
  9. package/dist/adapter/file/inMemory.persistence.plugin.js +1 -3
  10. package/dist/adapter/file/index.d.ts +1 -1
  11. package/dist/adapter/file/localFile.persistence.plugin.d.ts +3 -3
  12. package/dist/adapter/file/localFile.persistence.plugin.js +1 -0
  13. package/dist/adapter/file/noop.persistence.plugin.d.ts +3 -3
  14. package/dist/adapter/inmemory/inMemory.db.d.ts +6 -5
  15. package/dist/adapter/inmemory/inMemory.db.js +13 -10
  16. package/dist/adapter/inmemory/inMemoryKeyValueDB.d.ts +4 -4
  17. package/dist/adapter/inmemory/inMemoryKeyValueDB.js +6 -5
  18. package/dist/adapter/inmemory/queryInMemory.d.ts +2 -2
  19. package/dist/base.common.db.d.ts +6 -5
  20. package/dist/base.common.db.js +2 -4
  21. package/dist/common.db.d.ts +3 -3
  22. package/dist/commondao/common.dao.d.ts +9 -6
  23. package/dist/commondao/common.dao.js +6 -2
  24. package/dist/commondao/common.dao.model.d.ts +5 -4
  25. package/dist/db.model.d.ts +2 -2
  26. package/dist/kv/commonKeyValueDB.d.ts +3 -3
  27. package/dist/kv/commonKeyValueDao.d.ts +5 -5
  28. package/dist/kv/commonKeyValueDao.js +1 -0
  29. package/dist/kv/commonKeyValueDaoMemoCache.d.ts +3 -2
  30. package/dist/kv/commonKeyValueDaoMemoCache.js +1 -0
  31. package/dist/model.util.d.ts +1 -1
  32. package/dist/pipeline/dbPipelineBackup.d.ts +5 -3
  33. package/dist/pipeline/dbPipelineCopy.d.ts +6 -4
  34. package/dist/pipeline/dbPipelineRestore.d.ts +6 -4
  35. package/dist/query/dbQuery.d.ts +5 -5
  36. package/dist/query/dbQuery.js +15 -5
  37. package/dist/testing/daoTest.d.ts +3 -3
  38. package/dist/testing/daoTest.js +89 -74
  39. package/dist/testing/dbTest.d.ts +2 -3
  40. package/dist/testing/dbTest.js +68 -68
  41. package/dist/testing/index.d.ts +4 -2
  42. package/dist/testing/keyValueDBTest.d.ts +2 -2
  43. package/dist/testing/keyValueDBTest.js +37 -37
  44. package/dist/testing/keyValueDaoTest.d.ts +2 -2
  45. package/dist/testing/keyValueDaoTest.js +33 -33
  46. package/dist/testing/test.model.d.ts +1 -1
  47. package/dist/testing/timeSeriesTest.util.d.ts +1 -1
  48. package/dist/timeseries/commonTimeSeriesDao.d.ts +1 -1
  49. package/dist/timeseries/commonTimeSeriesDao.js +1 -0
  50. package/dist/timeseries/timeSeries.model.d.ts +1 -1
  51. package/dist/transaction/dbTransaction.util.d.ts +2 -2
  52. package/dist/transaction/dbTransaction.util.js +1 -0
  53. package/dist/validation/index.d.ts +2 -2
  54. package/package.json +3 -2
  55. package/src/adapter/cachedb/cache.db.model.ts +3 -3
  56. package/src/adapter/cachedb/cache.db.ts +8 -7
  57. package/src/adapter/cachedb/index.ts +1 -1
  58. package/src/adapter/file/file.db.model.ts +2 -2
  59. package/src/adapter/file/file.db.ts +9 -15
  60. package/src/adapter/file/inMemory.persistence.plugin.ts +4 -3
  61. package/src/adapter/file/index.ts +1 -1
  62. package/src/adapter/file/localFile.persistence.plugin.ts +4 -3
  63. package/src/adapter/file/noop.persistence.plugin.ts +3 -3
  64. package/src/adapter/inmemory/inMemory.db.ts +14 -20
  65. package/src/adapter/inmemory/inMemoryKeyValueDB.ts +5 -9
  66. package/src/adapter/inmemory/queryInMemory.ts +3 -2
  67. package/src/base.common.db.ts +6 -5
  68. package/src/common.db.ts +3 -3
  69. package/src/commondao/common.dao.model.ts +5 -6
  70. package/src/commondao/common.dao.ts +25 -21
  71. package/src/db.model.ts +2 -2
  72. package/src/kv/commonKeyValueDB.ts +3 -3
  73. package/src/kv/commonKeyValueDao.ts +7 -5
  74. package/src/kv/commonKeyValueDaoMemoCache.ts +3 -8
  75. package/src/model.util.ts +2 -1
  76. package/src/pipeline/dbPipelineBackup.ts +4 -13
  77. package/src/pipeline/dbPipelineCopy.ts +5 -13
  78. package/src/pipeline/dbPipelineRestore.ts +9 -8
  79. package/src/query/dbQuery.ts +6 -11
  80. package/src/testing/daoTest.ts +28 -6
  81. package/src/testing/dbTest.ts +24 -22
  82. package/src/testing/index.ts +3 -4
  83. package/src/testing/keyValueDBTest.ts +6 -4
  84. package/src/testing/keyValueDaoTest.ts +4 -3
  85. package/src/testing/test.model.ts +2 -7
  86. package/src/testing/timeSeriesTest.util.ts +1 -1
  87. package/src/timeseries/commonTimeSeriesDao.ts +3 -2
  88. package/src/timeseries/timeSeries.model.ts +1 -1
  89. package/src/transaction/dbTransaction.util.ts +2 -2
  90. package/src/validation/index.ts +3 -8
@@ -4,12 +4,12 @@ exports.runCommonDaoTest = runCommonDaoTest;
4
4
  const node_stream_1 = require("node:stream");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
7
- const vitest_1 = require("vitest");
8
7
  const __1 = require("..");
9
8
  const common_dao_1 = require("../commondao/common.dao");
10
- const dbTest_1 = require("./dbTest");
11
9
  const test_model_1 = require("./test.model");
12
- function runCommonDaoTest(db, quirks = {}) {
10
+ async function runCommonDaoTest(db, quirks = {}) {
11
+ // this is because vitest cannot be "required" from cjs
12
+ const { test, expect } = await import('vitest');
13
13
  const { support } = db;
14
14
  const dao = new common_dao_1.CommonDao({
15
15
  table: test_model_1.TEST_TABLE,
@@ -24,52 +24,52 @@ function runCommonDaoTest(db, quirks = {}) {
24
24
  const item1 = items[0];
25
25
  const expectedItems = items.map(i => ({
26
26
  ...i,
27
- updated: vitest_1.expect.any(Number),
27
+ updated: expect.any(Number),
28
28
  }));
29
- (0, vitest_1.test)('ping', async () => {
29
+ test('ping', async () => {
30
30
  await dao.ping();
31
31
  });
32
32
  // CREATE TABLE, DROP
33
33
  if (support.createTable) {
34
- (0, vitest_1.test)('createTable, dropIfExists=true', async () => {
34
+ test('createTable, dropIfExists=true', async () => {
35
35
  await dao.createTable(test_model_1.testItemBMJsonSchema, { dropIfExists: true });
36
36
  });
37
37
  }
38
38
  if (support.queries) {
39
39
  // DELETE ALL initially
40
- (0, vitest_1.test)('deleteByIds test items', async () => {
40
+ test('deleteByIds test items', async () => {
41
41
  const rows = await dao.query().select(['id']).runQuery();
42
42
  await db.deleteByQuery(__1.DBQuery.create(test_model_1.TEST_TABLE).filter('id', 'in', rows.map(r => r.id)));
43
43
  });
44
44
  // QUERY empty
45
- (0, vitest_1.test)('runQuery(all), runQueryCount should return empty', async () => {
46
- (0, vitest_1.expect)(await dao.query().runQuery()).toEqual([]);
47
- (0, vitest_1.expect)(await dao.query().runQueryCount()).toBe(0);
45
+ test('runQuery(all), runQueryCount should return empty', async () => {
46
+ expect(await dao.query().runQuery()).toEqual([]);
47
+ expect(await dao.query().runQueryCount()).toBe(0);
48
48
  });
49
49
  }
50
50
  // GET empty
51
- (0, vitest_1.test)('getByIds(item1.id) should return empty', async () => {
51
+ test('getByIds(item1.id) should return empty', async () => {
52
52
  const [item1Loaded] = await dao.getByIds([item1.id]);
53
- (0, vitest_1.expect)(item1Loaded).toBeUndefined();
54
- (0, vitest_1.expect)(await dao.getById(item1.id)).toBeNull();
53
+ expect(item1Loaded).toBeUndefined();
54
+ expect(await dao.getById(item1.id)).toBeNull();
55
55
  });
56
- (0, vitest_1.test)('getByIds([]) should return []', async () => {
57
- (0, vitest_1.expect)(await dao.getByIds([])).toEqual([]);
56
+ test('getByIds([]) should return []', async () => {
57
+ expect(await dao.getByIds([])).toEqual([]);
58
58
  });
59
- (0, vitest_1.test)('getByIds(...) should return empty', async () => {
60
- (0, vitest_1.expect)(await dao.getByIds(['abc', 'abcd'])).toEqual([]);
59
+ test('getByIds(...) should return empty', async () => {
60
+ expect(await dao.getByIds(['abc', 'abcd'])).toEqual([]);
61
61
  });
62
62
  // TimeMachine
63
63
  if (support.timeMachine) {
64
- (0, vitest_1.test)('getByIds(...) 10 minutes ago should return []', async () => {
65
- (0, vitest_1.expect)(await dao.getByIds([item1.id, 'abc'], {
64
+ test('getByIds(...) 10 minutes ago should return []', async () => {
65
+ expect(await dao.getByIds([item1.id, 'abc'], {
66
66
  readAt: js_lib_1.localTime.now().minus(10, 'minute').unix,
67
67
  })).toEqual([]);
68
68
  });
69
69
  }
70
70
  // SAVE
71
71
  if (support.nullValues) {
72
- (0, vitest_1.test)('should allow to save and load null values', async () => {
72
+ test('should allow to save and load null values', async () => {
73
73
  const item3 = {
74
74
  ...(0, test_model_1.createTestItemBM)(3),
75
75
  k2: null,
@@ -77,13 +77,13 @@ function runCommonDaoTest(db, quirks = {}) {
77
77
  // deepFreeze(item3) // no, Dao is expected to mutate object to add id, created, updated
78
78
  await dao.save(item3);
79
79
  const item3Loaded = await dao.requireById(item3.id);
80
- (0, dbTest_1.expectMatch)([item3], [item3Loaded], quirks);
81
- (0, vitest_1.expect)(item3Loaded.k2).toBeNull();
82
- (0, vitest_1.expect)(Object.keys(item3)).toContain('k2');
83
- (0, vitest_1.expect)(item3.k2).toBeNull();
80
+ expectMatch([item3], [item3Loaded], quirks);
81
+ expect(item3Loaded.k2).toBeNull();
82
+ expect(Object.keys(item3)).toContain('k2');
83
+ expect(item3.k2).toBeNull();
84
84
  });
85
85
  }
86
- (0, vitest_1.test)('undefined values should not be saved/loaded', async () => {
86
+ test('undefined values should not be saved/loaded', async () => {
87
87
  const item3 = {
88
88
  ...(0, test_model_1.createTestItemBM)(3),
89
89
  k2: undefined,
@@ -94,22 +94,22 @@ function runCommonDaoTest(db, quirks = {}) {
94
94
  await dao.save(item3);
95
95
  expected.updated = item3.updated; // as it's mutated
96
96
  const item3Loaded = await dao.requireById(item3.id);
97
- (0, dbTest_1.expectMatch)([expected], [item3Loaded], quirks);
98
- (0, vitest_1.expect)(item3Loaded.k2).toBeUndefined();
99
- (0, vitest_1.expect)(Object.keys(item3Loaded)).not.toContain('k2');
100
- (0, vitest_1.expect)(Object.keys(item3)).toContain('k2');
101
- (0, vitest_1.expect)(item3.k2).toBeUndefined();
97
+ expectMatch([expected], [item3Loaded], quirks);
98
+ expect(item3Loaded.k2).toBeUndefined();
99
+ expect(Object.keys(item3Loaded)).not.toContain('k2');
100
+ expect(Object.keys(item3)).toContain('k2');
101
+ expect(item3.k2).toBeUndefined();
102
102
  });
103
- (0, vitest_1.test)('saveBatch test items', async () => {
103
+ test('saveBatch test items', async () => {
104
104
  const itemsSaved = await dao.saveBatch(items);
105
- (0, vitest_1.expect)(itemsSaved[0]).toBe(items[0]); // expect "same object" returned
105
+ expect(itemsSaved[0]).toBe(items[0]); // expect "same object" returned
106
106
  // no unnecessary mutation
107
107
  const { updated: _, ...clone } = itemsClone[0];
108
- (0, vitest_1.expect)(items[0]).toMatchObject(clone);
109
- (0, dbTest_1.expectMatch)(expectedItems, itemsSaved, quirks);
108
+ expect(items[0]).toMatchObject(clone);
109
+ expectMatch(expectedItems, itemsSaved, quirks);
110
110
  });
111
111
  if (support.increment) {
112
- (0, vitest_1.test)('increment', async () => {
112
+ test('increment', async () => {
113
113
  await dao.incrementBatch('k3', { id1: 1, id2: 2 });
114
114
  let rows = await dao.query().runQuery();
115
115
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
@@ -128,104 +128,104 @@ function runCommonDaoTest(db, quirks = {}) {
128
128
  }
129
129
  return r;
130
130
  });
131
- (0, dbTest_1.expectMatch)(expected, rows, quirks);
131
+ expectMatch(expected, rows, quirks);
132
132
  // reset the changes
133
133
  await dao.increment('k3', 'id1', -1);
134
134
  await dao.increment('k3', 'id2', -2);
135
135
  });
136
136
  }
137
137
  // GET not empty
138
- (0, vitest_1.test)('getByIds all items', async () => {
138
+ test('getByIds all items', async () => {
139
139
  const rows = await dao.getByIds(items.map(i => i.id).concat('abcd'));
140
- (0, dbTest_1.expectMatch)(expectedItems, (0, js_lib_1._sortBy)(rows, r => r.id), quirks);
140
+ expectMatch(expectedItems, (0, js_lib_1._sortBy)(rows, r => r.id), quirks);
141
141
  });
142
142
  // QUERY
143
143
  if (support.queries) {
144
- (0, vitest_1.test)('runQuery(all) should return all items', async () => {
144
+ test('runQuery(all) should return all items', async () => {
145
145
  let rows = await dao.query().runQuery();
146
146
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
147
- (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
147
+ expectMatch(expectedItems, rows, quirks);
148
148
  });
149
149
  if (support.dbQueryFilter) {
150
- (0, vitest_1.test)('query even=true', async () => {
150
+ test('query even=true', async () => {
151
151
  let rows = await dao.query().filter('even', '==', true).runQuery();
152
152
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
153
- (0, dbTest_1.expectMatch)(expectedItems.filter(i => i.even), rows, quirks);
153
+ expectMatch(expectedItems.filter(i => i.even), rows, quirks);
154
154
  });
155
- (0, vitest_1.test)('query nested property', async () => {
155
+ test('query nested property', async () => {
156
156
  let rows = await dao
157
157
  .query()
158
158
  .filter('nested.foo', '==', 1)
159
159
  .runQuery();
160
160
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
161
- (0, dbTest_1.expectMatch)(expectedItems.filter(i => i.nested?.foo === 1), rows, quirks);
161
+ expectMatch(expectedItems.filter(i => i.nested?.foo === 1), rows, quirks);
162
162
  });
163
163
  }
164
164
  if (support.dbQueryOrder) {
165
- (0, vitest_1.test)('query order by k1 desc', async () => {
165
+ test('query order by k1 desc', async () => {
166
166
  const rows = await dao.query().order('k1', true).runQuery();
167
- (0, dbTest_1.expectMatch)([...expectedItems].reverse(), rows, quirks);
167
+ expectMatch([...expectedItems].reverse(), rows, quirks);
168
168
  });
169
169
  }
170
170
  if (support.dbQuerySelectFields) {
171
- (0, vitest_1.test)('projection query with only ids', async () => {
171
+ test('projection query with only ids', async () => {
172
172
  let rows = await dao.query().select(['id']).runQuery();
173
173
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
174
- (0, dbTest_1.expectMatch)(expectedItems.map(item => (0, js_lib_1._pick)(item, ['id'])), rows, quirks);
174
+ expectMatch(expectedItems.map(item => (0, js_lib_1._pick)(item, ['id'])), rows, quirks);
175
175
  });
176
176
  }
177
- (0, vitest_1.test)('runQueryCount should return 3', async () => {
178
- (0, vitest_1.expect)(await dao.query().runQueryCount()).toBe(3);
177
+ test('runQueryCount should return 3', async () => {
178
+ expect(await dao.query().runQueryCount()).toBe(3);
179
179
  });
180
180
  }
181
181
  // STREAM
182
182
  if (support.streaming) {
183
- (0, vitest_1.test)('streamQueryForEach all', async () => {
183
+ test('streamQueryForEach all', async () => {
184
184
  let rows = [];
185
185
  await dao.query().streamQueryForEach(bm => void rows.push(bm));
186
186
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
187
- (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
187
+ expectMatch(expectedItems, rows, quirks);
188
188
  });
189
- (0, vitest_1.test)('streamQuery all', async () => {
189
+ test('streamQuery all', async () => {
190
190
  let rows = await dao.query().streamQuery().toArray();
191
191
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
192
- (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
192
+ expectMatch(expectedItems, rows, quirks);
193
193
  });
194
- (0, vitest_1.test)('streamQueryIdsForEach all', async () => {
194
+ test('streamQueryIdsForEach all', async () => {
195
195
  let ids = [];
196
196
  await dao.query().streamQueryIdsForEach(id => void ids.push(id));
197
197
  ids = ids.sort();
198
- (0, dbTest_1.expectMatch)(expectedItems.map(i => i.id), ids, quirks);
198
+ expectMatch(expectedItems.map(i => i.id), ids, quirks);
199
199
  });
200
- (0, vitest_1.test)('streamQueryIds all', async () => {
200
+ test('streamQueryIds all', async () => {
201
201
  let ids = await dao.query().streamQueryIds().toArray();
202
202
  ids = ids.sort();
203
- (0, dbTest_1.expectMatch)(expectedItems.map(i => i.id), ids, quirks);
203
+ expectMatch(expectedItems.map(i => i.id), ids, quirks);
204
204
  });
205
- (0, vitest_1.test)('streamSaveTransform', async () => {
205
+ test('streamSaveTransform', async () => {
206
206
  const items2 = (0, test_model_1.createTestItemsBM)(2).map(i => ({ ...i, id: i.id + '_str' }));
207
207
  const ids = items2.map(i => i.id);
208
208
  await (0, nodejs_lib_1._pipeline)([node_stream_1.Readable.from(items2), ...dao.streamSaveTransform()]);
209
209
  const items2Loaded = await dao.getByIds(ids);
210
- (0, dbTest_1.expectMatch)(items2, items2Loaded, quirks);
210
+ expectMatch(items2, items2Loaded, quirks);
211
211
  // cleanup
212
212
  await dao.query().filterIn('id', ids).deleteByQuery();
213
213
  });
214
214
  }
215
215
  // DELETE BY
216
216
  if (support.queries) {
217
- (0, vitest_1.test)('deleteByQuery even=false', async () => {
217
+ test('deleteByQuery even=false', async () => {
218
218
  const deleted = await dao.query().filter('even', '==', false).deleteByQuery();
219
- (0, vitest_1.expect)(deleted).toBe(items.filter(item => !item.even).length);
220
- (0, vitest_1.expect)(await dao.query().runQueryCount()).toBe(1);
219
+ expect(deleted).toBe(items.filter(item => !item.even).length);
220
+ expect(await dao.query().runQueryCount()).toBe(1);
221
221
  });
222
- (0, vitest_1.test)('cleanup', async () => {
222
+ test('cleanup', async () => {
223
223
  // CLEAN UP
224
224
  await dao.query().deleteByQuery();
225
225
  });
226
226
  }
227
227
  if (support.transactions) {
228
- (0, vitest_1.test)('transaction happy path', async () => {
228
+ test('transaction happy path', async () => {
229
229
  // cleanup
230
230
  await dao.query().deleteByQuery();
231
231
  // Test that id, created, updated are created
@@ -235,10 +235,10 @@ function runCommonDaoTest(db, quirks = {}) {
235
235
  await tx.save(dao, row);
236
236
  });
237
237
  const loaded = await dao.query().runQuery();
238
- (0, vitest_1.expect)(loaded.length).toBe(1);
239
- (0, vitest_1.expect)(loaded[0].id).toBeDefined();
240
- (0, vitest_1.expect)(loaded[0].created).toBeGreaterThanOrEqual(now);
241
- (0, vitest_1.expect)(loaded[0].updated).toBe(loaded[0].created);
238
+ expect(loaded.length).toBe(1);
239
+ expect(loaded[0].id).toBeDefined();
240
+ expect(loaded[0].created).toBeGreaterThanOrEqual(now);
241
+ expect(loaded[0].updated).toBe(loaded[0].created);
242
242
  await dao.runInTransaction(async (tx) => {
243
243
  await tx.deleteById(dao, loaded[0].id);
244
244
  });
@@ -253,21 +253,36 @@ function runCommonDaoTest(db, quirks = {}) {
253
253
  });
254
254
  const rows = await dao.query().runQuery();
255
255
  const expected = [items[0], { ...items[2], k1: 'k1_mod' }];
256
- (0, dbTest_1.expectMatch)(expected, rows, quirks);
256
+ expectMatch(expected, rows, quirks);
257
257
  });
258
- (0, vitest_1.test)('transaction rollback', async () => {
259
- await (0, vitest_1.expect)(dao.runInTransaction(async (tx) => {
258
+ test('transaction rollback', async () => {
259
+ await expect(dao.runInTransaction(async (tx) => {
260
260
  await tx.deleteById(dao, items[2].id);
261
261
  await tx.save(dao, { ...items[0], k1: 5 }); // it should fail here
262
262
  })).rejects.toThrow();
263
263
  const rows = await dao.query().runQuery();
264
264
  const expected = [items[0], { ...items[2], k1: 'k1_mod' }];
265
- (0, dbTest_1.expectMatch)(expected, rows, quirks);
265
+ expectMatch(expected, rows, quirks);
266
266
  });
267
267
  if (support.queries) {
268
- (0, vitest_1.test)('transaction cleanup', async () => {
268
+ test('transaction cleanup', async () => {
269
269
  await dao.query().deleteByQuery();
270
270
  });
271
271
  }
272
272
  }
273
+ function expectMatch(expected, actual, quirks) {
274
+ // const expectedSorted = sortObjectDeep(expected)
275
+ // const actualSorted = sortObjectDeep(actual)
276
+ if (quirks.allowBooleansAsUndefined) {
277
+ expected = expected.map(r => {
278
+ return typeof r !== 'object' ? r : (0, js_lib_1._filterObject)(r, (_k, v) => v !== false);
279
+ });
280
+ }
281
+ if (quirks.allowExtraPropertiesInResponse) {
282
+ expect(actual).toMatchObject(expected);
283
+ }
284
+ else {
285
+ expect(actual).toEqual(expected);
286
+ }
287
+ }
273
288
  }
@@ -1,4 +1,4 @@
1
- import { CommonDB } from '../common.db';
1
+ import type { CommonDB } from '../common.db';
2
2
  /**
3
3
  * All options default to `false`.
4
4
  */
@@ -12,5 +12,4 @@ export interface CommonDBImplementationQuirks {
12
12
  */
13
13
  allowBooleansAsUndefined?: boolean;
14
14
  }
15
- export declare function runCommonDBTest(db: CommonDB, quirks?: CommonDBImplementationQuirks): void;
16
- export declare function expectMatch(expected: any[], actual: any[], quirks: CommonDBImplementationQuirks): void;
15
+ export declare function runCommonDBTest(db: CommonDB, quirks?: CommonDBImplementationQuirks): Promise<void>;