@naturalcycles/db-lib 9.28.0 → 10.0.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.
@@ -4,6 +4,7 @@ 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");
7
8
  const __1 = require("..");
8
9
  const common_dao_1 = require("../commondao/common.dao");
9
10
  const dbTest_1 = require("./dbTest");
@@ -23,52 +24,52 @@ function runCommonDaoTest(db, quirks = {}) {
23
24
  const item1 = items[0];
24
25
  const expectedItems = items.map(i => ({
25
26
  ...i,
26
- updated: expect.any(Number),
27
+ updated: vitest_1.expect.any(Number),
27
28
  }));
28
- test('ping', async () => {
29
+ (0, vitest_1.test)('ping', async () => {
29
30
  await dao.ping();
30
31
  });
31
32
  // CREATE TABLE, DROP
32
33
  if (support.createTable) {
33
- test('createTable, dropIfExists=true', async () => {
34
+ (0, vitest_1.test)('createTable, dropIfExists=true', async () => {
34
35
  await dao.createTable(test_model_1.testItemBMJsonSchema, { dropIfExists: true });
35
36
  });
36
37
  }
37
38
  if (support.queries) {
38
39
  // DELETE ALL initially
39
- test('deleteByIds test items', async () => {
40
+ (0, vitest_1.test)('deleteByIds test items', async () => {
40
41
  const rows = await dao.query().select(['id']).runQuery();
41
42
  await db.deleteByQuery(__1.DBQuery.create(test_model_1.TEST_TABLE).filter('id', 'in', rows.map(r => r.id)));
42
43
  });
43
44
  // QUERY empty
44
- test('runQuery(all), runQueryCount should return empty', async () => {
45
- expect(await dao.query().runQuery()).toEqual([]);
46
- expect(await dao.query().runQueryCount()).toBe(0);
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);
47
48
  });
48
49
  }
49
50
  // GET empty
50
- test('getByIds(item1.id) should return empty', async () => {
51
+ (0, vitest_1.test)('getByIds(item1.id) should return empty', async () => {
51
52
  const [item1Loaded] = await dao.getByIds([item1.id]);
52
- expect(item1Loaded).toBeUndefined();
53
- expect(await dao.getById(item1.id)).toBeNull();
53
+ (0, vitest_1.expect)(item1Loaded).toBeUndefined();
54
+ (0, vitest_1.expect)(await dao.getById(item1.id)).toBeNull();
54
55
  });
55
- test('getByIds([]) should return []', async () => {
56
- expect(await dao.getByIds([])).toEqual([]);
56
+ (0, vitest_1.test)('getByIds([]) should return []', async () => {
57
+ (0, vitest_1.expect)(await dao.getByIds([])).toEqual([]);
57
58
  });
58
- test('getByIds(...) should return empty', async () => {
59
- expect(await dao.getByIds(['abc', 'abcd'])).toEqual([]);
59
+ (0, vitest_1.test)('getByIds(...) should return empty', async () => {
60
+ (0, vitest_1.expect)(await dao.getByIds(['abc', 'abcd'])).toEqual([]);
60
61
  });
61
62
  // TimeMachine
62
63
  if (support.timeMachine) {
63
- test('getByIds(...) 10 minutes ago should return []', async () => {
64
- expect(await dao.getByIds([item1.id, 'abc'], {
64
+ (0, vitest_1.test)('getByIds(...) 10 minutes ago should return []', async () => {
65
+ (0, vitest_1.expect)(await dao.getByIds([item1.id, 'abc'], {
65
66
  readAt: js_lib_1.localTime.now().minus(10, 'minute').unix,
66
67
  })).toEqual([]);
67
68
  });
68
69
  }
69
70
  // SAVE
70
71
  if (support.nullValues) {
71
- test('should allow to save and load null values', async () => {
72
+ (0, vitest_1.test)('should allow to save and load null values', async () => {
72
73
  const item3 = {
73
74
  ...(0, test_model_1.createTestItemBM)(3),
74
75
  k2: null,
@@ -77,12 +78,12 @@ function runCommonDaoTest(db, quirks = {}) {
77
78
  await dao.save(item3);
78
79
  const item3Loaded = await dao.requireById(item3.id);
79
80
  (0, dbTest_1.expectMatch)([item3], [item3Loaded], quirks);
80
- expect(item3Loaded.k2).toBeNull();
81
- expect(Object.keys(item3)).toContain('k2');
82
- expect(item3.k2).toBeNull();
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();
83
84
  });
84
85
  }
85
- test('undefined values should not be saved/loaded', async () => {
86
+ (0, vitest_1.test)('undefined values should not be saved/loaded', async () => {
86
87
  const item3 = {
87
88
  ...(0, test_model_1.createTestItemBM)(3),
88
89
  k2: undefined,
@@ -94,21 +95,21 @@ function runCommonDaoTest(db, quirks = {}) {
94
95
  expected.updated = item3.updated; // as it's mutated
95
96
  const item3Loaded = await dao.requireById(item3.id);
96
97
  (0, dbTest_1.expectMatch)([expected], [item3Loaded], quirks);
97
- expect(item3Loaded.k2).toBeUndefined();
98
- expect(Object.keys(item3Loaded)).not.toContain('k2');
99
- expect(Object.keys(item3)).toContain('k2');
100
- expect(item3.k2).toBeUndefined();
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();
101
102
  });
102
- test('saveBatch test items', async () => {
103
+ (0, vitest_1.test)('saveBatch test items', async () => {
103
104
  const itemsSaved = await dao.saveBatch(items);
104
- expect(itemsSaved[0]).toBe(items[0]); // expect "same object" returned
105
+ (0, vitest_1.expect)(itemsSaved[0]).toBe(items[0]); // expect "same object" returned
105
106
  // no unnecessary mutation
106
107
  const { updated: _, ...clone } = itemsClone[0];
107
- expect(items[0]).toMatchObject(clone);
108
+ (0, vitest_1.expect)(items[0]).toMatchObject(clone);
108
109
  (0, dbTest_1.expectMatch)(expectedItems, itemsSaved, quirks);
109
110
  });
110
111
  if (support.increment) {
111
- test('increment', async () => {
112
+ (0, vitest_1.test)('increment', async () => {
112
113
  await dao.incrementBatch('k3', { id1: 1, id2: 2 });
113
114
  let rows = await dao.query().runQuery();
114
115
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
@@ -134,24 +135,24 @@ function runCommonDaoTest(db, quirks = {}) {
134
135
  });
135
136
  }
136
137
  // GET not empty
137
- test('getByIds all items', async () => {
138
+ (0, vitest_1.test)('getByIds all items', async () => {
138
139
  const rows = await dao.getByIds(items.map(i => i.id).concat('abcd'));
139
140
  (0, dbTest_1.expectMatch)(expectedItems, (0, js_lib_1._sortBy)(rows, r => r.id), quirks);
140
141
  });
141
142
  // QUERY
142
143
  if (support.queries) {
143
- test('runQuery(all) should return all items', async () => {
144
+ (0, vitest_1.test)('runQuery(all) should return all items', async () => {
144
145
  let rows = await dao.query().runQuery();
145
146
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
146
147
  (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
147
148
  });
148
149
  if (support.dbQueryFilter) {
149
- test('query even=true', async () => {
150
+ (0, vitest_1.test)('query even=true', async () => {
150
151
  let rows = await dao.query().filter('even', '==', true).runQuery();
151
152
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
152
153
  (0, dbTest_1.expectMatch)(expectedItems.filter(i => i.even), rows, quirks);
153
154
  });
154
- test('query nested property', async () => {
155
+ (0, vitest_1.test)('query nested property', async () => {
155
156
  let rows = await dao
156
157
  .query()
157
158
  .filter('nested.foo', '==', 1)
@@ -161,47 +162,47 @@ function runCommonDaoTest(db, quirks = {}) {
161
162
  });
162
163
  }
163
164
  if (support.dbQueryOrder) {
164
- test('query order by k1 desc', async () => {
165
+ (0, vitest_1.test)('query order by k1 desc', async () => {
165
166
  const rows = await dao.query().order('k1', true).runQuery();
166
167
  (0, dbTest_1.expectMatch)([...expectedItems].reverse(), rows, quirks);
167
168
  });
168
169
  }
169
170
  if (support.dbQuerySelectFields) {
170
- test('projection query with only ids', async () => {
171
+ (0, vitest_1.test)('projection query with only ids', async () => {
171
172
  let rows = await dao.query().select(['id']).runQuery();
172
173
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
173
174
  (0, dbTest_1.expectMatch)(expectedItems.map(item => (0, js_lib_1._pick)(item, ['id'])), rows, quirks);
174
175
  });
175
176
  }
176
- test('runQueryCount should return 3', async () => {
177
- expect(await dao.query().runQueryCount()).toBe(3);
177
+ (0, vitest_1.test)('runQueryCount should return 3', async () => {
178
+ (0, vitest_1.expect)(await dao.query().runQueryCount()).toBe(3);
178
179
  });
179
180
  }
180
181
  // STREAM
181
182
  if (support.streaming) {
182
- test('streamQueryForEach all', async () => {
183
+ (0, vitest_1.test)('streamQueryForEach all', async () => {
183
184
  let rows = [];
184
185
  await dao.query().streamQueryForEach(bm => void rows.push(bm));
185
186
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
186
187
  (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
187
188
  });
188
- test('streamQuery all', async () => {
189
+ (0, vitest_1.test)('streamQuery all', async () => {
189
190
  let rows = await dao.query().streamQuery().toArray();
190
191
  rows = (0, js_lib_1._sortBy)(rows, r => r.id);
191
192
  (0, dbTest_1.expectMatch)(expectedItems, rows, quirks);
192
193
  });
193
- test('streamQueryIdsForEach all', async () => {
194
+ (0, vitest_1.test)('streamQueryIdsForEach all', async () => {
194
195
  let ids = [];
195
196
  await dao.query().streamQueryIdsForEach(id => void ids.push(id));
196
197
  ids = ids.sort();
197
198
  (0, dbTest_1.expectMatch)(expectedItems.map(i => i.id), ids, quirks);
198
199
  });
199
- test('streamQueryIds all', async () => {
200
+ (0, vitest_1.test)('streamQueryIds all', async () => {
200
201
  let ids = await dao.query().streamQueryIds().toArray();
201
202
  ids = ids.sort();
202
203
  (0, dbTest_1.expectMatch)(expectedItems.map(i => i.id), ids, quirks);
203
204
  });
204
- test('streamSaveTransform', async () => {
205
+ (0, vitest_1.test)('streamSaveTransform', async () => {
205
206
  const items2 = (0, test_model_1.createTestItemsBM)(2).map(i => ({ ...i, id: i.id + '_str' }));
206
207
  const ids = items2.map(i => i.id);
207
208
  await (0, nodejs_lib_1._pipeline)([node_stream_1.Readable.from(items2), ...dao.streamSaveTransform()]);
@@ -213,18 +214,18 @@ function runCommonDaoTest(db, quirks = {}) {
213
214
  }
214
215
  // DELETE BY
215
216
  if (support.queries) {
216
- test('deleteByQuery even=false', async () => {
217
+ (0, vitest_1.test)('deleteByQuery even=false', async () => {
217
218
  const deleted = await dao.query().filter('even', '==', false).deleteByQuery();
218
- expect(deleted).toBe(items.filter(item => !item.even).length);
219
- expect(await dao.query().runQueryCount()).toBe(1);
219
+ (0, vitest_1.expect)(deleted).toBe(items.filter(item => !item.even).length);
220
+ (0, vitest_1.expect)(await dao.query().runQueryCount()).toBe(1);
220
221
  });
221
- test('cleanup', async () => {
222
+ (0, vitest_1.test)('cleanup', async () => {
222
223
  // CLEAN UP
223
224
  await dao.query().deleteByQuery();
224
225
  });
225
226
  }
226
227
  if (support.transactions) {
227
- test('transaction happy path', async () => {
228
+ (0, vitest_1.test)('transaction happy path', async () => {
228
229
  // cleanup
229
230
  await dao.query().deleteByQuery();
230
231
  // Test that id, created, updated are created
@@ -234,10 +235,10 @@ function runCommonDaoTest(db, quirks = {}) {
234
235
  await tx.save(dao, row);
235
236
  });
236
237
  const loaded = await dao.query().runQuery();
237
- expect(loaded.length).toBe(1);
238
- expect(loaded[0].id).toBeDefined();
239
- expect(loaded[0].created).toBeGreaterThanOrEqual(now);
240
- expect(loaded[0].updated).toBe(loaded[0].created);
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);
241
242
  await dao.runInTransaction(async (tx) => {
242
243
  await tx.deleteById(dao, loaded[0].id);
243
244
  });
@@ -254,8 +255,8 @@ function runCommonDaoTest(db, quirks = {}) {
254
255
  const expected = [items[0], { ...items[2], k1: 'k1_mod' }];
255
256
  (0, dbTest_1.expectMatch)(expected, rows, quirks);
256
257
  });
257
- test('transaction rollback', async () => {
258
- await expect(dao.runInTransaction(async (tx) => {
258
+ (0, vitest_1.test)('transaction rollback', async () => {
259
+ await (0, vitest_1.expect)(dao.runInTransaction(async (tx) => {
259
260
  await tx.deleteById(dao, items[2].id);
260
261
  await tx.save(dao, { ...items[0], k1: 5 }); // it should fail here
261
262
  })).rejects.toThrow();
@@ -264,7 +265,7 @@ function runCommonDaoTest(db, quirks = {}) {
264
265
  (0, dbTest_1.expectMatch)(expected, rows, quirks);
265
266
  });
266
267
  if (support.queries) {
267
- test('transaction cleanup', async () => {
268
+ (0, vitest_1.test)('transaction cleanup', async () => {
268
269
  await dao.query().deleteByQuery();
269
270
  });
270
271
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCommonDBTest = runCommonDBTest;
4
4
  exports.expectMatch = expectMatch;
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
+ const vitest_1 = require("vitest");
6
7
  const common_db_1 = require("../common.db");
7
8
  const dbQuery_1 = require("../query/dbQuery");
8
9
  const test_model_1 = require("./test.model");
@@ -12,50 +13,50 @@ function runCommonDBTest(db, quirks = {}) {
12
13
  (0, js_lib_1._deepFreeze)(items);
13
14
  const item1 = items[0];
14
15
  const queryAll = () => dbQuery_1.DBQuery.create(test_model_1.TEST_TABLE);
15
- test('ping', async () => {
16
+ (0, vitest_1.test)('ping', async () => {
16
17
  await db.ping();
17
18
  });
18
19
  // CREATE TABLE, DROP
19
20
  if (support.createTable) {
20
- test('createTable, dropIfExists=true', async () => {
21
+ (0, vitest_1.test)('createTable, dropIfExists=true', async () => {
21
22
  await db.createTable(test_model_1.TEST_TABLE, test_model_1.testItemBMJsonSchema, { dropIfExists: true });
22
23
  });
23
24
  }
24
25
  if (support.queries) {
25
26
  // DELETE ALL initially
26
- test('deleteByIds test items', async () => {
27
+ (0, vitest_1.test)('deleteByIds test items', async () => {
27
28
  const { rows } = await db.runQuery(queryAll().select(['id']));
28
29
  await db.deleteByQuery(queryAll().filterIn('id', rows.map(i => i.id)));
29
30
  });
30
31
  // QUERY empty
31
- test('runQuery(all), runQueryCount should return empty', async () => {
32
- expect((await db.runQuery(queryAll())).rows).toEqual([]);
33
- expect(await db.runQueryCount(queryAll())).toBe(0);
32
+ (0, vitest_1.test)('runQuery(all), runQueryCount should return empty', async () => {
33
+ (0, vitest_1.expect)((await db.runQuery(queryAll())).rows).toEqual([]);
34
+ (0, vitest_1.expect)(await db.runQueryCount(queryAll())).toBe(0);
34
35
  });
35
36
  }
36
37
  // GET empty
37
- test('getByIds(item1.id) should return empty', async () => {
38
+ (0, vitest_1.test)('getByIds(item1.id) should return empty', async () => {
38
39
  const [item1Loaded] = await db.getByIds(test_model_1.TEST_TABLE, [item1.id]);
39
40
  // console.log(a)
40
- expect(item1Loaded).toBeUndefined();
41
+ (0, vitest_1.expect)(item1Loaded).toBeUndefined();
41
42
  });
42
- test('getByIds([]) should return []', async () => {
43
- expect(await db.getByIds(test_model_1.TEST_TABLE, [])).toEqual([]);
43
+ (0, vitest_1.test)('getByIds([]) should return []', async () => {
44
+ (0, vitest_1.expect)(await db.getByIds(test_model_1.TEST_TABLE, [])).toEqual([]);
44
45
  });
45
- test('getByIds(...) should return empty', async () => {
46
- expect(await db.getByIds(test_model_1.TEST_TABLE, ['abc', 'abcd'])).toEqual([]);
46
+ (0, vitest_1.test)('getByIds(...) should return empty', async () => {
47
+ (0, vitest_1.expect)(await db.getByIds(test_model_1.TEST_TABLE, ['abc', 'abcd'])).toEqual([]);
47
48
  });
48
49
  // TimeMachine
49
50
  if (support.timeMachine) {
50
- test('getByIds(...) 10 minutes ago should return []', async () => {
51
- expect(await db.getByIds(test_model_1.TEST_TABLE, [item1.id, 'abc'], {
51
+ (0, vitest_1.test)('getByIds(...) 10 minutes ago should return []', async () => {
52
+ (0, vitest_1.expect)(await db.getByIds(test_model_1.TEST_TABLE, [item1.id, 'abc'], {
52
53
  readAt: js_lib_1.localTime.now().minus(10, 'minute').unix,
53
54
  })).toEqual([]);
54
55
  });
55
56
  }
56
57
  // SAVE
57
58
  if (support.nullValues) {
58
- test('should allow to save and load null values', async () => {
59
+ (0, vitest_1.test)('should allow to save and load null values', async () => {
59
60
  const item3 = {
60
61
  ...(0, test_model_1.createTestItemDBM)(3),
61
62
  k2: null,
@@ -64,11 +65,11 @@ function runCommonDBTest(db, quirks = {}) {
64
65
  await db.saveBatch(test_model_1.TEST_TABLE, [item3]);
65
66
  const item3Loaded = (await db.getByIds(test_model_1.TEST_TABLE, [item3.id]))[0];
66
67
  expectMatch([item3], [item3Loaded], quirks);
67
- expect(item3Loaded.k2).toBeNull();
68
+ (0, vitest_1.expect)(item3Loaded.k2).toBeNull();
68
69
  });
69
70
  }
70
71
  if (db.dbType === common_db_1.CommonDBType.document) {
71
- test('undefined values should not be saved/loaded', async () => {
72
+ (0, vitest_1.test)('undefined values should not be saved/loaded', async () => {
72
73
  const item3 = {
73
74
  ...(0, test_model_1.createTestItemDBM)(3),
74
75
  k2: undefined,
@@ -79,45 +80,45 @@ function runCommonDBTest(db, quirks = {}) {
79
80
  await db.saveBatch(test_model_1.TEST_TABLE, [item3]);
80
81
  const item3Loaded = (await db.getByIds(test_model_1.TEST_TABLE, [item3.id]))[0];
81
82
  expectMatch([expected], [item3Loaded], quirks);
82
- expect(item3Loaded.k2).toBeUndefined();
83
- expect(Object.keys(item3Loaded)).not.toContain('k2');
83
+ (0, vitest_1.expect)(item3Loaded.k2).toBeUndefined();
84
+ (0, vitest_1.expect)(Object.keys(item3Loaded)).not.toContain('k2');
84
85
  });
85
86
  }
86
87
  if (support.updateSaveMethod) {
87
- test('saveBatch UPDATE method should throw', async () => {
88
- await expect(db.saveBatch(test_model_1.TEST_TABLE, items, { saveMethod: 'update' })).rejects.toThrow();
88
+ (0, vitest_1.test)('saveBatch UPDATE method should throw', async () => {
89
+ await (0, vitest_1.expect)(db.saveBatch(test_model_1.TEST_TABLE, items, { saveMethod: 'update' })).rejects.toThrow();
89
90
  });
90
91
  }
91
- test('saveBatch test items', async () => {
92
+ (0, vitest_1.test)('saveBatch test items', async () => {
92
93
  await db.saveBatch(test_model_1.TEST_TABLE, items);
93
94
  });
94
- test('saveBatch should throw on null id', async () => {
95
- await expect(db.saveBatch(test_model_1.TEST_TABLE, [{ ...item1, id: null }])).rejects.toThrow();
95
+ (0, vitest_1.test)('saveBatch should throw on null id', async () => {
96
+ await (0, vitest_1.expect)(db.saveBatch(test_model_1.TEST_TABLE, [{ ...item1, id: null }])).rejects.toThrow();
96
97
  });
97
98
  if (support.insertSaveMethod) {
98
- test('saveBatch INSERT method should throw', async () => {
99
- await expect(db.saveBatch(test_model_1.TEST_TABLE, items, { saveMethod: 'insert' })).rejects.toThrow();
99
+ (0, vitest_1.test)('saveBatch INSERT method should throw', async () => {
100
+ await (0, vitest_1.expect)(db.saveBatch(test_model_1.TEST_TABLE, items, { saveMethod: 'insert' })).rejects.toThrow();
100
101
  });
101
102
  }
102
103
  if (support.updateSaveMethod) {
103
- test('saveBatch UPDATE method should pass', async () => {
104
+ (0, vitest_1.test)('saveBatch UPDATE method should pass', async () => {
104
105
  await db.saveBatch(test_model_1.TEST_TABLE, items, { saveMethod: 'update' });
105
106
  });
106
107
  }
107
108
  // GET not empty
108
- test('getByIds all items', async () => {
109
+ (0, vitest_1.test)('getByIds all items', async () => {
109
110
  const rows = await db.getByIds(test_model_1.TEST_TABLE, items.map(i => i.id).concat('abcd'));
110
111
  expectMatch(items, (0, js_lib_1._sortBy)(rows, r => r.id), quirks);
111
112
  });
112
113
  // QUERY
113
114
  if (support.queries) {
114
- test('runQuery(all) should return all items', async () => {
115
+ (0, vitest_1.test)('runQuery(all) should return all items', async () => {
115
116
  let { rows } = await db.runQuery(queryAll());
116
117
  rows = (0, js_lib_1._sortBy)(rows, r => r.id); // because query doesn't specify order here
117
118
  expectMatch(items, rows, quirks);
118
119
  });
119
120
  if (support.dbQueryFilter) {
120
- test('query even=true', async () => {
121
+ (0, vitest_1.test)('query even=true', async () => {
121
122
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).filter('even', '==', true);
122
123
  let { rows } = await db.runQuery(q);
123
124
  if (!support.dbQueryOrder)
@@ -126,67 +127,67 @@ function runCommonDBTest(db, quirks = {}) {
126
127
  });
127
128
  }
128
129
  if (support.dbQueryOrder) {
129
- test('query order by k1 desc', async () => {
130
+ (0, vitest_1.test)('query order by k1 desc', async () => {
130
131
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).order('k1', true);
131
132
  const { rows } = await db.runQuery(q);
132
133
  expectMatch([...items].reverse(), rows, quirks);
133
134
  });
134
135
  }
135
136
  if (support.dbQuerySelectFields) {
136
- test('projection query with only ids', async () => {
137
+ (0, vitest_1.test)('projection query with only ids', async () => {
137
138
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).select(['id']);
138
139
  let { rows } = await db.runQuery(q);
139
140
  rows = (0, js_lib_1._sortBy)(rows, r => r.id); // cause order is not specified
140
141
  expectMatch(items.map(item => (0, js_lib_1._pick)(item, ['id'])), rows, quirks);
141
142
  });
142
- test('projection query without ids', async () => {
143
+ (0, vitest_1.test)('projection query without ids', async () => {
143
144
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).select(['k1']);
144
145
  let { rows } = await db.runQuery(q);
145
146
  rows = (0, js_lib_1._sortBy)(rows, r => r.k1); // cause order is not specified
146
147
  expectMatch(items.map(item => (0, js_lib_1._pick)(item, ['k1'])), rows, quirks);
147
148
  });
148
- test('projection query empty fields (edge case)', async () => {
149
+ (0, vitest_1.test)('projection query empty fields (edge case)', async () => {
149
150
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).select([]);
150
151
  const { rows } = await db.runQuery(q);
151
152
  expectMatch(items.map(() => ({})), rows, quirks);
152
153
  });
153
154
  }
154
- test('runQueryCount should return 3', async () => {
155
- expect(await db.runQueryCount(new dbQuery_1.DBQuery(test_model_1.TEST_TABLE))).toBe(3);
155
+ (0, vitest_1.test)('runQueryCount should return 3', async () => {
156
+ (0, vitest_1.expect)(await db.runQueryCount(new dbQuery_1.DBQuery(test_model_1.TEST_TABLE))).toBe(3);
156
157
  });
157
158
  }
158
159
  // STREAM
159
160
  if (support.streaming) {
160
- test('streamQuery all', async () => {
161
+ (0, vitest_1.test)('streamQuery all', async () => {
161
162
  let rows = await db.streamQuery(queryAll()).toArray();
162
163
  rows = (0, js_lib_1._sortBy)(rows, r => r.id); // cause order is not specified in DBQuery
163
164
  expectMatch(items, rows, quirks);
164
165
  });
165
166
  }
166
167
  // getTables
167
- test('getTables, getTableSchema (if supported)', async () => {
168
+ (0, vitest_1.test)('getTables, getTableSchema (if supported)', async () => {
168
169
  const tables = await db.getTables();
169
170
  // console.log({ tables })
170
171
  if (support.tableSchemas) {
171
172
  await (0, js_lib_1.pMap)(tables, async (table) => {
172
173
  const schema = await db.getTableSchema(table);
173
174
  // console.log(schema)
174
- expect(schema.$id).toBe(`${table}.schema.json`);
175
+ (0, vitest_1.expect)(schema.$id).toBe(`${table}.schema.json`);
175
176
  });
176
177
  }
177
178
  });
178
179
  // DELETE BY
179
180
  if (support.queries && support.dbQueryFilter) {
180
- test('deleteByQuery even=false', async () => {
181
+ (0, vitest_1.test)('deleteByQuery even=false', async () => {
181
182
  const q = new dbQuery_1.DBQuery(test_model_1.TEST_TABLE).filter('even', '==', false);
182
183
  const deleted = await db.deleteByQuery(q);
183
- expect(deleted).toBe(items.filter(item => !item.even).length);
184
- expect(await db.runQueryCount(queryAll())).toBe(1);
184
+ (0, vitest_1.expect)(deleted).toBe(items.filter(item => !item.even).length);
185
+ (0, vitest_1.expect)(await db.runQueryCount(queryAll())).toBe(1);
185
186
  });
186
187
  }
187
188
  // BUFFER
188
189
  if (support.bufferValues) {
189
- test('buffer values', async () => {
190
+ (0, vitest_1.test)('buffer values', async () => {
190
191
  const s = 'helloWorld 1';
191
192
  const b1 = Buffer.from(s);
192
193
  const item = {
@@ -204,12 +205,12 @@ function runCommonDBTest(db, quirks = {}) {
204
205
  // b1,
205
206
  // b1Loaded,
206
207
  // })
207
- expect(b1Loaded).toEqual(b1);
208
- expect(b1Loaded.toString()).toBe(s);
208
+ (0, vitest_1.expect)(b1Loaded).toEqual(b1);
209
+ (0, vitest_1.expect)(b1Loaded.toString()).toBe(s);
209
210
  });
210
211
  }
211
212
  if (support.transactions) {
212
- test('transaction happy path', async () => {
213
+ (0, vitest_1.test)('transaction happy path', async () => {
213
214
  // cleanup
214
215
  await db.deleteByQuery(queryAll());
215
216
  // saveBatch [item1, 2, 3]
@@ -225,7 +226,7 @@ function runCommonDBTest(db, quirks = {}) {
225
226
  const expected = [items[0], { ...items[2], k1: 'k1_mod' }];
226
227
  expectMatch(expected, rows, quirks);
227
228
  });
228
- test('transaction rollback', async () => {
229
+ (0, vitest_1.test)('transaction rollback', async () => {
229
230
  let err;
230
231
  try {
231
232
  await db.runInTransaction(async (tx) => {
@@ -237,14 +238,14 @@ function runCommonDBTest(db, quirks = {}) {
237
238
  catch (err_) {
238
239
  err = err_;
239
240
  }
240
- expect(err).toBeDefined();
241
+ (0, vitest_1.expect)(err).toBeDefined();
241
242
  const { rows } = await db.runQuery(queryAll());
242
243
  const expected = [items[0], { ...items[2], k1: 'k1_mod' }];
243
244
  expectMatch(expected, rows, quirks);
244
245
  });
245
246
  }
246
247
  if (support.patchByQuery) {
247
- test('patchByQuery', async () => {
248
+ (0, vitest_1.test)('patchByQuery', async () => {
248
249
  // cleanup, reset initial data
249
250
  await db.deleteByQuery(queryAll());
250
251
  await db.saveBatch(test_model_1.TEST_TABLE, items);
@@ -264,7 +265,7 @@ function runCommonDBTest(db, quirks = {}) {
264
265
  });
265
266
  }
266
267
  if (support.increment) {
267
- test('incrementBatch', async () => {
268
+ (0, vitest_1.test)('incrementBatch', async () => {
268
269
  // cleanup, reset initial data
269
270
  await db.deleteByQuery(queryAll());
270
271
  await db.saveBatch(test_model_1.TEST_TABLE, items);
@@ -283,7 +284,7 @@ function runCommonDBTest(db, quirks = {}) {
283
284
  });
284
285
  }
285
286
  if (support.queries) {
286
- test('cleanup', async () => {
287
+ (0, vitest_1.test)('cleanup', async () => {
287
288
  // CLEAN UP
288
289
  await db.deleteByQuery(queryAll());
289
290
  });
@@ -298,9 +299,9 @@ function expectMatch(expected, actual, quirks) {
298
299
  });
299
300
  }
300
301
  if (quirks.allowExtraPropertiesInResponse) {
301
- expect(actual).toMatchObject(expected);
302
+ (0, vitest_1.expect)(actual).toMatchObject(expected);
302
303
  }
303
304
  else {
304
- expect(actual).toEqual(expected);
305
+ (0, vitest_1.expect)(actual).toEqual(expected);
305
306
  }
306
307
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCommonKeyValueDBTest = runCommonKeyValueDBTest;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
+ const vitest_1 = require("vitest");
5
6
  const test_model_1 = require("./test.model");
6
7
  const testIds = (0, js_lib_1._range)(1, 4).map(n => `id${n}`);
7
8
  const testEntries = testIds.map(id => [
@@ -9,7 +10,7 @@ const testEntries = testIds.map(id => [
9
10
  Buffer.from(`${id}value`),
10
11
  ]);
11
12
  function runCommonKeyValueDBTest(db) {
12
- beforeAll(async () => {
13
+ (0, vitest_1.beforeAll)(async () => {
13
14
  // Tests in this suite are not isolated,
14
15
  // and failing tests can leave the DB in an unexpected state for other tests,
15
16
  // including the following test run.
@@ -17,98 +18,98 @@ function runCommonKeyValueDBTest(db) {
17
18
  const ids = await db.streamIds(test_model_1.TEST_TABLE).toArray();
18
19
  await db.deleteByIds(test_model_1.TEST_TABLE, ids);
19
20
  });
20
- afterAll(async () => {
21
+ (0, vitest_1.afterAll)(async () => {
21
22
  const ids = await db.streamIds(test_model_1.TEST_TABLE).toArray();
22
23
  await db.deleteByIds(test_model_1.TEST_TABLE, ids);
23
24
  });
24
25
  const { support } = db;
25
- test('ping', async () => {
26
+ (0, vitest_1.test)('ping', async () => {
26
27
  await db.ping();
27
28
  });
28
- test('createTable', async () => {
29
+ (0, vitest_1.test)('createTable', async () => {
29
30
  await db.createTable(test_model_1.TEST_TABLE, { dropIfExists: true });
30
31
  });
31
- test('deleteByIds non existing', async () => {
32
+ (0, vitest_1.test)('deleteByIds non existing', async () => {
32
33
  await db.deleteByIds(test_model_1.TEST_TABLE, testIds);
33
34
  });
34
- test('getByIds should return empty', async () => {
35
+ (0, vitest_1.test)('getByIds should return empty', async () => {
35
36
  const results = await db.getByIds(test_model_1.TEST_TABLE, testIds);
36
- expect(results).toEqual([]);
37
+ (0, vitest_1.expect)(results).toEqual([]);
37
38
  });
38
- test('count should be 0', async () => {
39
- expect(await db.count(test_model_1.TEST_TABLE)).toBe(0);
39
+ (0, vitest_1.test)('count should be 0', async () => {
40
+ (0, vitest_1.expect)(await db.count(test_model_1.TEST_TABLE)).toBe(0);
40
41
  });
41
- test('saveBatch, then getByIds', async () => {
42
+ (0, vitest_1.test)('saveBatch, then getByIds', async () => {
42
43
  await db.saveBatch(test_model_1.TEST_TABLE, testEntries);
43
44
  const entries = await db.getByIds(test_model_1.TEST_TABLE, testIds);
44
45
  (0, js_lib_1._sortBy)(entries, e => e[0], true);
45
- expect(entries).toEqual(testEntries);
46
+ (0, vitest_1.expect)(entries).toEqual(testEntries);
46
47
  });
47
48
  if (support.count) {
48
- test('count should be 3', async () => {
49
- expect(await db.count(test_model_1.TEST_TABLE)).toBe(3);
49
+ (0, vitest_1.test)('count should be 3', async () => {
50
+ (0, vitest_1.expect)(await db.count(test_model_1.TEST_TABLE)).toBe(3);
50
51
  });
51
52
  }
52
- test('streamIds', async () => {
53
+ (0, vitest_1.test)('streamIds', async () => {
53
54
  const ids = await db.streamIds(test_model_1.TEST_TABLE).toArray();
54
55
  ids.sort();
55
- expect(ids).toEqual(testIds);
56
+ (0, vitest_1.expect)(ids).toEqual(testIds);
56
57
  });
57
- test('streamIds limited', async () => {
58
+ (0, vitest_1.test)('streamIds limited', async () => {
58
59
  const idsLimited = await db.streamIds(test_model_1.TEST_TABLE, 2).toArray();
59
60
  // Order is non-deterministic, so, cannot compare values
60
61
  // idsLimited.sort()
61
62
  // expect(idsLimited).toEqual(testIds.slice(0, 2))
62
- expect(idsLimited.length).toBe(2);
63
+ (0, vitest_1.expect)(idsLimited.length).toBe(2);
63
64
  });
64
- test('streamValues', async () => {
65
+ (0, vitest_1.test)('streamValues', async () => {
65
66
  const values = await db.streamValues(test_model_1.TEST_TABLE).toArray();
66
67
  values.sort();
67
- expect(values).toEqual(testEntries.map(e => e[1]));
68
+ (0, vitest_1.expect)(values).toEqual(testEntries.map(e => e[1]));
68
69
  });
69
- test('streamValues limited', async () => {
70
+ (0, vitest_1.test)('streamValues limited', async () => {
70
71
  const valuesLimited = await db.streamValues(test_model_1.TEST_TABLE, 2).toArray();
71
72
  // valuesLimited.sort()
72
73
  // expect(valuesLimited).toEqual(testEntries.map(e => e[1]).slice(0, 2))
73
- expect(valuesLimited.length).toBe(2);
74
+ (0, vitest_1.expect)(valuesLimited.length).toBe(2);
74
75
  });
75
- test('streamEntries', async () => {
76
+ (0, vitest_1.test)('streamEntries', async () => {
76
77
  const entries = await db.streamEntries(test_model_1.TEST_TABLE).toArray();
77
78
  entries.sort();
78
- expect(entries).toEqual(testEntries);
79
+ (0, vitest_1.expect)(entries).toEqual(testEntries);
79
80
  });
80
- test('streamEntries limited', async () => {
81
+ (0, vitest_1.test)('streamEntries limited', async () => {
81
82
  const entriesLimited = await db.streamEntries(test_model_1.TEST_TABLE, 2).toArray();
82
83
  // entriesLimited.sort()
83
84
  // expect(entriesLimited).toEqual(testEntries.slice(0, 2))
84
- expect(entriesLimited.length).toBe(2);
85
+ (0, vitest_1.expect)(entriesLimited.length).toBe(2);
85
86
  });
86
- test('deleteByIds should clear', async () => {
87
+ (0, vitest_1.test)('deleteByIds should clear', async () => {
87
88
  await db.deleteByIds(test_model_1.TEST_TABLE, testIds);
88
89
  const results = await db.getByIds(test_model_1.TEST_TABLE, testIds);
89
- expect(results).toEqual([]);
90
+ (0, vitest_1.expect)(results).toEqual([]);
90
91
  });
91
92
  if (support.increment) {
92
93
  const id = 'nonExistingField';
93
94
  const id2 = 'nonExistingField2';
94
- test('increment on a non-existing field should set the value to 1', async () => {
95
+ (0, vitest_1.test)('increment on a non-existing field should set the value to 1', async () => {
95
96
  const result = await db.incrementBatch(test_model_1.TEST_TABLE, [[id, 1]]);
96
- expect(result).toEqual([[id, 1]]);
97
+ (0, vitest_1.expect)(result).toEqual([[id, 1]]);
97
98
  });
98
- test('increment on a existing field should increase the value by one', async () => {
99
+ (0, vitest_1.test)('increment on a existing field should increase the value by one', async () => {
99
100
  const result = await db.incrementBatch(test_model_1.TEST_TABLE, [[id, 1]]);
100
- expect(result).toEqual([[id, 2]]);
101
+ (0, vitest_1.expect)(result).toEqual([[id, 2]]);
101
102
  });
102
- test('increment should increase the value by the specified amount', async () => {
103
+ (0, vitest_1.test)('increment should increase the value by the specified amount', async () => {
103
104
  const result = await db.incrementBatch(test_model_1.TEST_TABLE, [[id, 2]]);
104
- expect(result).toEqual([[id, 4]]);
105
+ (0, vitest_1.expect)(result).toEqual([[id, 4]]);
105
106
  });
106
- test('increment 2 ids at the same time', async () => {
107
+ (0, vitest_1.test)('increment 2 ids at the same time', async () => {
107
108
  const result = await db.incrementBatch(test_model_1.TEST_TABLE, [
108
109
  [id, 1],
109
110
  [id2, 2],
110
111
  ]);
111
- expect(Object.fromEntries(result)).toEqual({
112
+ (0, vitest_1.expect)(Object.fromEntries(result)).toEqual({
112
113
  [id]: 5,
113
114
  [id2]: 2,
114
115
  });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCommonKeyValueDaoTest = runCommonKeyValueDaoTest;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
+ const vitest_1 = require("vitest");
5
6
  const commonKeyValueDao_1 = require("../kv/commonKeyValueDao");
6
7
  const test_model_1 = require("./test.model");
7
8
  const testItems = (0, test_model_1.createTestItemsBM)(4);
@@ -14,7 +15,7 @@ function runCommonKeyValueDaoTest(db) {
14
15
  // todo: make this test support "deflatedJson" transformer
15
16
  });
16
17
  const { support } = db;
17
- beforeAll(async () => {
18
+ (0, vitest_1.beforeAll)(async () => {
18
19
  // Tests in this suite are not isolated,
19
20
  // and failing tests can leave the DB in an unexpected state for other tests,
20
21
  // including the following test run.
@@ -22,92 +23,92 @@ function runCommonKeyValueDaoTest(db) {
22
23
  const ids = await dao.streamIds().toArray();
23
24
  await dao.deleteByIds(ids);
24
25
  });
25
- afterAll(async () => {
26
+ (0, vitest_1.afterAll)(async () => {
26
27
  const ids = await dao.streamIds().toArray();
27
28
  await dao.deleteByIds(ids);
28
29
  });
29
- test('ping', async () => {
30
+ (0, vitest_1.test)('ping', async () => {
30
31
  await dao.ping();
31
32
  });
32
- test('createTable', async () => {
33
+ (0, vitest_1.test)('createTable', async () => {
33
34
  await dao.createTable({ dropIfExists: true });
34
35
  });
35
- test('deleteByIds non existing', async () => {
36
+ (0, vitest_1.test)('deleteByIds non existing', async () => {
36
37
  await dao.deleteByIds(testIds);
37
38
  });
38
- test('getByIds should return empty', async () => {
39
+ (0, vitest_1.test)('getByIds should return empty', async () => {
39
40
  const results = await dao.getByIds(testIds);
40
- expect(results).toEqual([]);
41
+ (0, vitest_1.expect)(results).toEqual([]);
41
42
  });
42
- test('saveBatch, then getByIds', async () => {
43
+ (0, vitest_1.test)('saveBatch, then getByIds', async () => {
43
44
  await dao.saveBatch(testEntries);
44
45
  const entries = await dao.getByIds(testIds);
45
46
  // console.log(typeof entries[0]![1], entries[0]![1])
46
47
  (0, js_lib_1._sortBy)(entries, e => e[0], true);
47
- expect(entries).toEqual(testEntries); // Jest doesn't allow to compare Buffers directly
48
+ (0, vitest_1.expect)(entries).toEqual(testEntries); // Jest doesn't allow to compare Buffers directly
48
49
  // expect(entries.map(e => e[0])).toEqual(testEntries.map(e => e[0]))
49
50
  // expect(entries.map(e => e[1].toString())).toEqual(testEntries.map(e => e[1].toString()))
50
51
  });
51
- test('streamIds', async () => {
52
+ (0, vitest_1.test)('streamIds', async () => {
52
53
  const ids = await dao.streamIds().toArray();
53
54
  ids.sort();
54
- expect(ids).toEqual(testIds);
55
+ (0, vitest_1.expect)(ids).toEqual(testIds);
55
56
  });
56
- test('streamIds limited', async () => {
57
+ (0, vitest_1.test)('streamIds limited', async () => {
57
58
  const idsLimited = await dao.streamIds(2).toArray();
58
59
  // Order is non-deterministic, so, cannot compare values
59
60
  // idsLimited.sort()
60
61
  // expect(idsLimited).toEqual(testIds.slice(0, 2))
61
- expect(idsLimited.length).toBe(2);
62
+ (0, vitest_1.expect)(idsLimited.length).toBe(2);
62
63
  });
63
- test('streamValues', async () => {
64
+ (0, vitest_1.test)('streamValues', async () => {
64
65
  const values = await dao.streamValues().toArray();
65
66
  values.sort();
66
- expect(values).toEqual(testEntries.map(e => e[1]));
67
+ (0, vitest_1.expect)(values).toEqual(testEntries.map(e => e[1]));
67
68
  });
68
- test('streamValues limited', async () => {
69
+ (0, vitest_1.test)('streamValues limited', async () => {
69
70
  const valuesLimited = await dao.streamValues(2).toArray();
70
71
  // valuesLimited.sort()
71
72
  // expect(valuesLimited).toEqual(testEntries.map(e => e[1]).slice(0, 2))
72
- expect(valuesLimited.length).toBe(2);
73
+ (0, vitest_1.expect)(valuesLimited.length).toBe(2);
73
74
  });
74
- test('streamEntries', async () => {
75
+ (0, vitest_1.test)('streamEntries', async () => {
75
76
  const entries = await dao.streamEntries().toArray();
76
77
  entries.sort();
77
- expect(entries).toEqual(testEntries);
78
+ (0, vitest_1.expect)(entries).toEqual(testEntries);
78
79
  });
79
- test('streamEntries limited', async () => {
80
+ (0, vitest_1.test)('streamEntries limited', async () => {
80
81
  const entriesLimited = await dao.streamEntries(2).toArray();
81
82
  // entriesLimited.sort()
82
83
  // expect(entriesLimited).toEqual(testEntries.slice(0, 2))
83
- expect(entriesLimited.length).toBe(2);
84
+ (0, vitest_1.expect)(entriesLimited.length).toBe(2);
84
85
  });
85
- test('deleteByIds should clear', async () => {
86
+ (0, vitest_1.test)('deleteByIds should clear', async () => {
86
87
  await dao.deleteByIds(testIds);
87
88
  const results = await dao.getByIds(testIds);
88
- expect(results).toEqual([]);
89
+ (0, vitest_1.expect)(results).toEqual([]);
89
90
  });
90
91
  if (support.increment) {
91
92
  const id = 'nonExistingField';
92
93
  const id2 = 'nonExistingField2';
93
- test('increment on a non-existing field should set the value to 1', async () => {
94
+ (0, vitest_1.test)('increment on a non-existing field should set the value to 1', async () => {
94
95
  const result = await dao.increment(id);
95
- expect(result).toBe(1);
96
+ (0, vitest_1.expect)(result).toBe(1);
96
97
  });
97
- test('increment on a existing field should increase the value by one', async () => {
98
+ (0, vitest_1.test)('increment on a existing field should increase the value by one', async () => {
98
99
  const result = await dao.increment(id);
99
- expect(result).toBe(2);
100
+ (0, vitest_1.expect)(result).toBe(2);
100
101
  });
101
- test('increment should increase the value by the specified amount', async () => {
102
+ (0, vitest_1.test)('increment should increase the value by the specified amount', async () => {
102
103
  const result = await dao.increment(id, 2);
103
- expect(result).toBe(4);
104
+ (0, vitest_1.expect)(result).toBe(4);
104
105
  });
105
- test('increment 2 ids at the same time', async () => {
106
+ (0, vitest_1.test)('increment 2 ids at the same time', async () => {
106
107
  const result = await dao.incrementBatch([
107
108
  [id, 1],
108
109
  [id2, 2],
109
110
  ]);
110
- expect(Object.fromEntries(result)).toEqual({
111
+ (0, vitest_1.expect)(Object.fromEntries(result)).toEqual({
111
112
  [id]: 5,
112
113
  [id2]: 2,
113
114
  });
package/package.json CHANGED
@@ -14,9 +14,10 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@naturalcycles/bench-lib": "^3",
17
- "@naturalcycles/dev-lib": "^15",
17
+ "@naturalcycles/dev-lib": "^16",
18
18
  "@types/node": "^22",
19
- "jest": "^29"
19
+ "@vitest/coverage-v8": "^3",
20
+ "vitest": "^3"
20
21
  },
21
22
  "files": [
22
23
  "dist",
@@ -43,9 +44,9 @@
43
44
  "url": "https://github.com/NaturalCycles/db-lib"
44
45
  },
45
46
  "engines": {
46
- "node": ">=22.10.0"
47
+ "node": ">=22.12.0"
47
48
  },
48
- "version": "9.28.0",
49
+ "version": "10.0.0",
49
50
  "description": "Lowest Common Denominator API to supported Databases",
50
51
  "keywords": [
51
52
  "db",
@@ -1,6 +1,7 @@
1
1
  import { Readable } from 'node:stream'
2
2
  import { _deepCopy, _omit, _pick, _sortBy, localTime } from '@naturalcycles/js-lib'
3
3
  import { _pipeline } from '@naturalcycles/nodejs-lib'
4
+ import { expect, test } from 'vitest'
4
5
  import { CommonDaoLogLevel, DBQuery } from '..'
5
6
  import { CommonDB } from '../common.db'
6
7
  import { CommonDao } from '../commondao/common.dao'
@@ -1,4 +1,5 @@
1
1
  import { _deepFreeze, _filterObject, _pick, _sortBy, localTime, pMap } from '@naturalcycles/js-lib'
2
+ import { expect, test } from 'vitest'
2
3
  import { CommonDB, CommonDBType } from '../common.db'
3
4
  import { DBQuery } from '../query/dbQuery'
4
5
  import {
@@ -1,4 +1,5 @@
1
1
  import { _range, _sortBy, KeyValueTuple } from '@naturalcycles/js-lib'
2
+ import { afterAll, beforeAll, expect, test } from 'vitest'
2
3
  import { CommonKeyValueDB } from '../kv/commonKeyValueDB'
3
4
  import { TEST_TABLE } from './test.model'
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { _sortBy } from '@naturalcycles/js-lib'
2
+ import { afterAll, beforeAll, expect, test } from 'vitest'
2
3
  import { CommonKeyValueDao } from '../kv/commonKeyValueDao'
3
4
  import { CommonKeyValueDB, KeyValueDBTuple } from '../kv/commonKeyValueDB'
4
5
  import { createTestItemsBM, TEST_TABLE } from './test.model'