@naturalcycles/db-lib 8.48.0 → 8.48.1
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/dist/testing/dbTest.js +5 -4
- package/package.json +1 -1
- package/src/testing/dbTest.ts +6 -8
package/dist/testing/dbTest.js
CHANGED
|
@@ -37,7 +37,7 @@ function runCommonDBTest(db, features = {}, quirks = {}) {
|
|
|
37
37
|
// DELETE ALL initially
|
|
38
38
|
test('deleteByIds test items', async () => {
|
|
39
39
|
const { rows } = await db.runQuery(queryAll().select(['id']));
|
|
40
|
-
await db.
|
|
40
|
+
await db.deleteByQuery(queryAll().filterIn('id', rows.map(i => i.id)));
|
|
41
41
|
});
|
|
42
42
|
// QUERY empty
|
|
43
43
|
test('runQuery(all), runQueryCount should return empty', async () => {
|
|
@@ -54,10 +54,10 @@ function runCommonDBTest(db, features = {}, quirks = {}) {
|
|
|
54
54
|
expect(item1Loaded).toBeUndefined();
|
|
55
55
|
});
|
|
56
56
|
test('getByIds([]) should return []', async () => {
|
|
57
|
-
expect((await db.runQuery(queryAll().
|
|
57
|
+
expect((await db.runQuery(queryAll().filterIn('id', []))).rows).toEqual([]);
|
|
58
58
|
});
|
|
59
59
|
test('getByIds(...) should return empty', async () => {
|
|
60
|
-
expect((await db.runQuery(queryAll().
|
|
60
|
+
expect((await db.runQuery(queryAll().filterIn('id', ['abc', 'abcd']))).rows).toEqual([]);
|
|
61
61
|
});
|
|
62
62
|
// SAVE
|
|
63
63
|
if (nullValues) {
|
|
@@ -112,7 +112,8 @@ function runCommonDBTest(db, features = {}, quirks = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
// GET not empty
|
|
114
114
|
test('getByIds all items', async () => {
|
|
115
|
-
const rows = (await db.runQuery(queryAll().
|
|
115
|
+
const rows = (await db.runQuery(queryAll().filterIn('id', items.map(i => i.id).concat('abcd'))))
|
|
116
|
+
.rows;
|
|
116
117
|
expectMatch(items, (0, js_lib_1._sortBy)(rows, r => r.id), quirks);
|
|
117
118
|
});
|
|
118
119
|
// QUERY
|
package/package.json
CHANGED
package/src/testing/dbTest.ts
CHANGED
|
@@ -129,10 +129,9 @@ export function runCommonDBTest(
|
|
|
129
129
|
// DELETE ALL initially
|
|
130
130
|
test('deleteByIds test items', async () => {
|
|
131
131
|
const { rows } = await db.runQuery(queryAll().select(['id']))
|
|
132
|
-
await db.
|
|
133
|
-
queryAll().
|
|
132
|
+
await db.deleteByQuery(
|
|
133
|
+
queryAll().filterIn(
|
|
134
134
|
'id',
|
|
135
|
-
'in',
|
|
136
135
|
rows.map(i => i.id),
|
|
137
136
|
),
|
|
138
137
|
)
|
|
@@ -154,11 +153,11 @@ export function runCommonDBTest(
|
|
|
154
153
|
})
|
|
155
154
|
|
|
156
155
|
test('getByIds([]) should return []', async () => {
|
|
157
|
-
expect((await db.runQuery(queryAll().
|
|
156
|
+
expect((await db.runQuery(queryAll().filterIn('id', []))).rows).toEqual([])
|
|
158
157
|
})
|
|
159
158
|
|
|
160
159
|
test('getByIds(...) should return empty', async () => {
|
|
161
|
-
expect((await db.runQuery(queryAll().
|
|
160
|
+
expect((await db.runQuery(queryAll().filterIn('id', ['abc', 'abcd']))).rows).toEqual([])
|
|
162
161
|
})
|
|
163
162
|
|
|
164
163
|
// SAVE
|
|
@@ -222,9 +221,8 @@ export function runCommonDBTest(
|
|
|
222
221
|
|
|
223
222
|
// GET not empty
|
|
224
223
|
test('getByIds all items', async () => {
|
|
225
|
-
const rows = (
|
|
226
|
-
|
|
227
|
-
).rows
|
|
224
|
+
const rows = (await db.runQuery(queryAll().filterIn('id', items.map(i => i.id).concat('abcd'))))
|
|
225
|
+
.rows
|
|
228
226
|
expectMatch(
|
|
229
227
|
items,
|
|
230
228
|
_sortBy(rows, r => r.id),
|