@travetto/model-query 8.0.0-alpha.28 → 8.0.0-alpha.29
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/package.json +2 -2
- package/support/test/query.ts +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-query",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Datastore abstraction for advanced query support.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@travetto/schema": "^8.0.0-alpha.25"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/test": "^8.0.0-alpha.
|
|
35
|
+
"@travetto/test": "^8.0.0-alpha.24"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/test": {
|
package/support/test/query.ts
CHANGED
|
@@ -170,6 +170,62 @@ export abstract class ModelQuerySuite extends BaseModelSuite<ModelQuerySupport &
|
|
|
170
170
|
assert(idNin.length === 2);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
@Test('Verify list intersection queries')
|
|
174
|
+
async testListIntersection() {
|
|
175
|
+
const service = await this.service;
|
|
176
|
+
|
|
177
|
+
await this.saveAll(SimpleList, [
|
|
178
|
+
SimpleList.from({
|
|
179
|
+
names: ['apple', 'banana']
|
|
180
|
+
}),
|
|
181
|
+
SimpleList.from({
|
|
182
|
+
names: ['banana', 'cherry']
|
|
183
|
+
}),
|
|
184
|
+
SimpleList.from({
|
|
185
|
+
names: ['cherry', 'date']
|
|
186
|
+
}),
|
|
187
|
+
SimpleList.from({
|
|
188
|
+
names: ['elderberry']
|
|
189
|
+
})
|
|
190
|
+
]);
|
|
191
|
+
|
|
192
|
+
const singleMatch = await service.query(SimpleList, {
|
|
193
|
+
where: {
|
|
194
|
+
names: {
|
|
195
|
+
$in: ['apple']
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
assert(singleMatch.length === 1);
|
|
200
|
+
|
|
201
|
+
const intersectionMatch = await service.query(SimpleList, {
|
|
202
|
+
where: {
|
|
203
|
+
names: {
|
|
204
|
+
$in: ['banana', 'cherry']
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
assert(intersectionMatch.length === 3);
|
|
209
|
+
|
|
210
|
+
const disjointIntersectionMatch = await service.query(SimpleList, {
|
|
211
|
+
where: {
|
|
212
|
+
names: {
|
|
213
|
+
$in: ['apple', 'date']
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
assert(disjointIntersectionMatch.length === 2);
|
|
218
|
+
|
|
219
|
+
const noIntersectionMatch = await service.query(SimpleList, {
|
|
220
|
+
where: {
|
|
221
|
+
names: {
|
|
222
|
+
$in: ['fig', 'grape']
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
assert(noIntersectionMatch.length === 0);
|
|
227
|
+
}
|
|
228
|
+
|
|
173
229
|
@Test('verify all operators')
|
|
174
230
|
async testArrayAll() {
|
|
175
231
|
const service = await this.service;
|