@nymphjs/nymph 1.0.0-alpha.1 → 1.0.0-alpha.13
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/CHANGELOG.md +66 -0
- package/README.md +17 -7
- package/dist/Entity.d.ts +3 -0
- package/dist/Entity.js +15 -17
- package/dist/Entity.js.map +1 -1
- package/dist/Entity.test.js +6 -3
- package/dist/Entity.test.js.map +1 -1
- package/dist/Entity.types.d.ts +4 -1
- package/dist/Nymph.d.ts +56 -53
- package/dist/Nymph.js +138 -67
- package/dist/Nymph.js.map +1 -1
- package/dist/Nymph.types.d.ts +49 -28
- package/dist/Nymph.types.js +8 -0
- package/dist/Nymph.types.js.map +1 -1
- package/dist/driver/NymphDriver.d.ts +5 -2
- package/dist/driver/NymphDriver.js +68 -39
- package/dist/driver/NymphDriver.js.map +1 -1
- package/dist/driver/testArtifacts.d.ts +4 -3
- package/dist/driver/testArtifacts.js +265 -167
- package/dist/driver/testArtifacts.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/nymphJoiProps.d.ts +8 -0
- package/dist/nymphJoiProps.js +24 -0
- package/dist/nymphJoiProps.js.map +1 -0
- package/dist/testArtifacts.js +0 -3
- package/dist/testArtifacts.js.map +1 -1
- package/dist/testMocks.d.ts +14 -13
- package/dist/testMocks.js +21 -11
- package/dist/testMocks.js.map +1 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +9 -10
- package/dist/utils.js.map +1 -1
- package/package.json +3 -2
- package/src/Entity.test.ts +7 -4
- package/src/Entity.ts +22 -12
- package/src/Entity.types.ts +10 -1
- package/src/Nymph.ts +203 -119
- package/src/Nymph.types.ts +91 -22
- package/src/driver/NymphDriver.ts +93 -46
- package/src/driver/testArtifacts.ts +307 -161
- package/src/index.ts +3 -1
- package/src/nymphJoiProps.ts +24 -0
- package/src/testArtifacts.ts +0 -5
- package/src/testMocks.ts +34 -29
- package/src/utils.ts +12 -10
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import strtotime from 'locutus/php/datetime/strtotime';
|
|
3
3
|
|
|
4
|
+
import type Nymph from '../Nymph';
|
|
4
5
|
import newGUID from '../newGUID';
|
|
5
|
-
import Nymph from '../Nymph';
|
|
6
6
|
import { TestBModel, TestModel, TestModelData } from '../testArtifacts';
|
|
7
7
|
|
|
8
|
-
export function QueriesTest(
|
|
8
|
+
export function QueriesTest(
|
|
9
|
+
nymph: Nymph,
|
|
10
|
+
it: (name: string, fn: () => void) => void
|
|
11
|
+
) {
|
|
12
|
+
nymph.addEntityClass(TestModel);
|
|
13
|
+
nymph.addEntityClass(TestBModel);
|
|
14
|
+
|
|
9
15
|
let testEntity: TestModel & TestModelData;
|
|
10
16
|
let testGuid: string;
|
|
11
17
|
let refGuid: string;
|
|
@@ -50,7 +56,7 @@ This one's zip code is 92064.`;
|
|
|
50
56
|
expect(await entityReferenceTest.$save()).toEqual(true);
|
|
51
57
|
|
|
52
58
|
// Test synchronous getEntity.
|
|
53
|
-
testEntity =
|
|
59
|
+
testEntity = nymph.driver.getEntitySync(
|
|
54
60
|
{ class: TestModel },
|
|
55
61
|
testGuid
|
|
56
62
|
) as TestModel & TestModelData;
|
|
@@ -58,7 +64,7 @@ This one's zip code is 92064.`;
|
|
|
58
64
|
expect(testEntity.guid).toEqual(testGuid);
|
|
59
65
|
|
|
60
66
|
// Test asynchronous getEntity.
|
|
61
|
-
testEntity = (await
|
|
67
|
+
testEntity = (await nymph.getEntity(
|
|
62
68
|
{ class: TestModel },
|
|
63
69
|
testGuid
|
|
64
70
|
)) as TestModel & TestModelData;
|
|
@@ -84,13 +90,13 @@ This one's zip code is 92064.`;
|
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
it('delete old test data', async () => {
|
|
87
|
-
let all = await
|
|
93
|
+
let all = await nymph.getEntities({ class: TestModel });
|
|
88
94
|
expect(Array.isArray(all)).toEqual(true);
|
|
89
95
|
for (const cur of all) {
|
|
90
96
|
expect(await cur.$delete()).toEqual(true);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
all = await
|
|
99
|
+
all = await nymph.getEntities({ class: TestModel });
|
|
94
100
|
expect(all.length).toEqual(0);
|
|
95
101
|
});
|
|
96
102
|
|
|
@@ -117,7 +123,7 @@ This one's zip code is 92064.`;
|
|
|
117
123
|
await createTestEntities();
|
|
118
124
|
|
|
119
125
|
// Retrieving entity by GUID...
|
|
120
|
-
let resultEntity = await
|
|
126
|
+
let resultEntity = await nymph.getEntity({ class: TestModel }, testGuid);
|
|
121
127
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
122
128
|
|
|
123
129
|
// Using class constructor...
|
|
@@ -125,7 +131,7 @@ This one's zip code is 92064.`;
|
|
|
125
131
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
126
132
|
|
|
127
133
|
// Testing wrong GUID...
|
|
128
|
-
resultEntity = await
|
|
134
|
+
resultEntity = await nymph.getEntity({ class: TestModel }, newGUID());
|
|
129
135
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
130
136
|
});
|
|
131
137
|
|
|
@@ -133,54 +139,56 @@ This one's zip code is 92064.`;
|
|
|
133
139
|
await createTestEntities();
|
|
134
140
|
|
|
135
141
|
// Verify not in a transaction.
|
|
136
|
-
expect(await
|
|
142
|
+
expect(await nymph.inTransaction()).toEqual(false);
|
|
137
143
|
|
|
138
|
-
|
|
144
|
+
let transaction = await nymph.startTransaction('test');
|
|
145
|
+
testEntity.$nymph = transaction;
|
|
139
146
|
|
|
140
|
-
if (!transaction) {
|
|
147
|
+
if (!(await transaction.inTransaction())) {
|
|
141
148
|
console.log(
|
|
142
149
|
'This Nymph driver or database seems to not support transactions. Skipping transaction tests.'
|
|
143
150
|
);
|
|
144
|
-
await
|
|
151
|
+
await transaction.rollback('test');
|
|
145
152
|
return;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
|
-
// Verify in a transaction.
|
|
149
|
-
expect(await Nymph.inTransaction()).toEqual(true);
|
|
150
|
-
|
|
151
155
|
// Change a value in the test entity.
|
|
152
156
|
testEntity.string = 'bad value';
|
|
153
157
|
expect(await testEntity.$save()).toEqual(true);
|
|
154
158
|
|
|
155
159
|
// Rollback the transaction.
|
|
156
|
-
await
|
|
160
|
+
await transaction.rollback('test');
|
|
157
161
|
|
|
158
162
|
// Verify not in a transaction.
|
|
159
|
-
expect(await
|
|
163
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
160
164
|
|
|
161
165
|
// Verify the value is correct.
|
|
162
166
|
await testEntity.$refresh();
|
|
163
167
|
expect(testEntity.string).toEqual('test');
|
|
164
168
|
|
|
165
169
|
// Start a new transaction.
|
|
166
|
-
await
|
|
170
|
+
transaction = await nymph.startTransaction('test');
|
|
171
|
+
testEntity.$nymph = transaction;
|
|
167
172
|
|
|
168
173
|
// Verify in a transaction.
|
|
169
|
-
expect(await
|
|
174
|
+
expect(await transaction.inTransaction()).toEqual(true);
|
|
170
175
|
|
|
171
176
|
// Delete the entity.
|
|
172
177
|
expect(await testEntity.$delete()).toEqual(true);
|
|
173
|
-
const resultEntity = await
|
|
178
|
+
const resultEntity = await transaction.getEntity(
|
|
179
|
+
{ class: TestModel },
|
|
180
|
+
testGuid
|
|
181
|
+
);
|
|
174
182
|
expect(resultEntity).toBeNull();
|
|
175
183
|
|
|
176
184
|
// Rollback the transaction.
|
|
177
|
-
await
|
|
185
|
+
await transaction.rollback('test');
|
|
178
186
|
|
|
179
187
|
// Verify not in a transaction.
|
|
180
|
-
expect(await
|
|
188
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
181
189
|
|
|
182
190
|
// Verify it's back.
|
|
183
|
-
testEntity = (await
|
|
191
|
+
testEntity = (await transaction.getEntity(
|
|
184
192
|
{ class: TestModel },
|
|
185
193
|
testGuid
|
|
186
194
|
)) as TestModel & TestModelData;
|
|
@@ -188,20 +196,22 @@ This one's zip code is 92064.`;
|
|
|
188
196
|
expect(testEntity.guid).toEqual(testGuid);
|
|
189
197
|
|
|
190
198
|
// Start a new transaction.
|
|
191
|
-
await
|
|
199
|
+
transaction = await nymph.startTransaction('test');
|
|
200
|
+
testEntity.$nymph = transaction;
|
|
192
201
|
|
|
193
202
|
// Verify in a transaction.
|
|
194
|
-
expect(await
|
|
203
|
+
expect(await transaction.inTransaction()).toEqual(true);
|
|
195
204
|
|
|
196
205
|
// Make a change.
|
|
197
206
|
testEntity.string = 'fish';
|
|
198
207
|
expect(await testEntity.$save()).toEqual(true);
|
|
199
208
|
|
|
200
209
|
// Commit the transaction.
|
|
201
|
-
await
|
|
210
|
+
await transaction.commit('test');
|
|
211
|
+
testEntity.$nymph = nymph;
|
|
202
212
|
|
|
203
213
|
// Verify not in a transaction.
|
|
204
|
-
expect(await
|
|
214
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
205
215
|
|
|
206
216
|
// Verify the value is correct.
|
|
207
217
|
await testEntity.$refresh();
|
|
@@ -218,7 +228,7 @@ This one's zip code is 92064.`;
|
|
|
218
228
|
await createTestEntities();
|
|
219
229
|
|
|
220
230
|
// Testing entity order, offset, limit...
|
|
221
|
-
const resultEntities = await
|
|
231
|
+
const resultEntities = await nymph.getEntities(
|
|
222
232
|
{
|
|
223
233
|
class: TestModel,
|
|
224
234
|
reverse: true,
|
|
@@ -236,7 +246,7 @@ This one's zip code is 92064.`;
|
|
|
236
246
|
await createTestEntities();
|
|
237
247
|
|
|
238
248
|
// Retrieving entity by GUID and tags...
|
|
239
|
-
const resultEntity = await
|
|
249
|
+
const resultEntity = await nymph.getEntity(
|
|
240
250
|
{ class: TestModel },
|
|
241
251
|
{ type: '&', guid: testGuid, tag: 'test' }
|
|
242
252
|
);
|
|
@@ -247,7 +257,7 @@ This one's zip code is 92064.`;
|
|
|
247
257
|
await createTestEntities();
|
|
248
258
|
|
|
249
259
|
// Retrieving entity by GUID and tags...
|
|
250
|
-
const resultEntity = await
|
|
260
|
+
const resultEntity = await nymph.getEntity(
|
|
251
261
|
{ class: TestModel },
|
|
252
262
|
{ type: '|', guid: [testGuid, newGUID()] }
|
|
253
263
|
);
|
|
@@ -258,7 +268,7 @@ This one's zip code is 92064.`;
|
|
|
258
268
|
await createTestEntities();
|
|
259
269
|
|
|
260
270
|
// Retrieving entity by GUID and tags...
|
|
261
|
-
const resultEntity = await
|
|
271
|
+
const resultEntity = await nymph.getEntity(
|
|
262
272
|
{ class: TestModel },
|
|
263
273
|
{ type: '|', guid: [newGUID(), newGUID()] }
|
|
264
274
|
);
|
|
@@ -269,7 +279,7 @@ This one's zip code is 92064.`;
|
|
|
269
279
|
await createTestEntities();
|
|
270
280
|
|
|
271
281
|
// Retrieving entity by !GUID...
|
|
272
|
-
const resultEntity = await
|
|
282
|
+
const resultEntity = await nymph.getEntities(
|
|
273
283
|
{ class: TestModel },
|
|
274
284
|
{ type: '&', '!guid': newGUID(), tag: 'test' }
|
|
275
285
|
);
|
|
@@ -280,7 +290,7 @@ This one's zip code is 92064.`;
|
|
|
280
290
|
await createTestEntities();
|
|
281
291
|
|
|
282
292
|
// Retrieving entity by !tags...
|
|
283
|
-
const resultEntity = await
|
|
293
|
+
const resultEntity = await nymph.getEntities(
|
|
284
294
|
{ class: TestModel },
|
|
285
295
|
{ type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] }
|
|
286
296
|
);
|
|
@@ -291,7 +301,7 @@ This one's zip code is 92064.`;
|
|
|
291
301
|
await createTestEntities();
|
|
292
302
|
|
|
293
303
|
// Testing GUID and wrong tags...
|
|
294
|
-
const resultEntity = await
|
|
304
|
+
const resultEntity = await nymph.getEntity(
|
|
295
305
|
{ class: TestModel },
|
|
296
306
|
{ type: '&', guid: testGuid, tag: ['pickles'] }
|
|
297
307
|
);
|
|
@@ -302,7 +312,7 @@ This one's zip code is 92064.`;
|
|
|
302
312
|
await createTestEntities();
|
|
303
313
|
|
|
304
314
|
// Retrieving entity by tags...
|
|
305
|
-
const resultEntity = await
|
|
315
|
+
const resultEntity = await nymph.getEntities(
|
|
306
316
|
{ class: TestModel },
|
|
307
317
|
{ type: '&', tag: 'test' }
|
|
308
318
|
);
|
|
@@ -313,7 +323,7 @@ This one's zip code is 92064.`;
|
|
|
313
323
|
await createTestEntities();
|
|
314
324
|
|
|
315
325
|
// Testing wrong tags...
|
|
316
|
-
const resultEntity = await
|
|
326
|
+
const resultEntity = await nymph.getEntities(
|
|
317
327
|
{ class: TestModel },
|
|
318
328
|
{ type: '&', tag: 'pickles' }
|
|
319
329
|
);
|
|
@@ -324,7 +334,7 @@ This one's zip code is 92064.`;
|
|
|
324
334
|
await createTestEntities();
|
|
325
335
|
|
|
326
336
|
// Retrieving entity by tags inclusively...
|
|
327
|
-
const resultEntity = await
|
|
337
|
+
const resultEntity = await nymph.getEntities(
|
|
328
338
|
{ class: TestModel },
|
|
329
339
|
{ type: '|', tag: ['pickles', 'test', 'barbecue'] }
|
|
330
340
|
);
|
|
@@ -335,7 +345,7 @@ This one's zip code is 92064.`;
|
|
|
335
345
|
await createTestEntities();
|
|
336
346
|
|
|
337
347
|
// Testing wrong inclusive tags...
|
|
338
|
-
const resultEntity = await
|
|
348
|
+
const resultEntity = await nymph.getEntities(
|
|
339
349
|
{ class: TestModel },
|
|
340
350
|
{ type: '|', tag: ['pickles', 'barbecue'] }
|
|
341
351
|
);
|
|
@@ -346,7 +356,7 @@ This one's zip code is 92064.`;
|
|
|
346
356
|
await createTestEntities();
|
|
347
357
|
|
|
348
358
|
// Retrieving entity by mixed tags...
|
|
349
|
-
const resultEntity = await
|
|
359
|
+
const resultEntity = await nymph.getEntities(
|
|
350
360
|
{ class: TestModel },
|
|
351
361
|
{ type: '&', tag: 'test' },
|
|
352
362
|
{ type: '|', tag: ['pickles', 'test', 'barbecue'] }
|
|
@@ -358,7 +368,7 @@ This one's zip code is 92064.`;
|
|
|
358
368
|
await createTestEntities();
|
|
359
369
|
|
|
360
370
|
// Testing wrong inclusive mixed tags...
|
|
361
|
-
const resultEntity = await
|
|
371
|
+
const resultEntity = await nymph.getEntities(
|
|
362
372
|
{ class: TestModel },
|
|
363
373
|
{ type: '&', tag: 'test' },
|
|
364
374
|
{ type: '|', tag: ['pickles', 'barbecue'] }
|
|
@@ -370,7 +380,7 @@ This one's zip code is 92064.`;
|
|
|
370
380
|
await createTestEntities();
|
|
371
381
|
|
|
372
382
|
// Testing wrong exclusive mixed tags...
|
|
373
|
-
const resultEntity = await
|
|
383
|
+
const resultEntity = await nymph.getEntities(
|
|
374
384
|
{ class: TestModel },
|
|
375
385
|
{ type: '&', tag: 'pickles' },
|
|
376
386
|
{ type: '|', tag: ['test', 'barbecue'] }
|
|
@@ -382,7 +392,7 @@ This one's zip code is 92064.`;
|
|
|
382
392
|
await createTestEntities();
|
|
383
393
|
|
|
384
394
|
// Retrieving entity by defined...
|
|
385
|
-
const resultEntity = await
|
|
395
|
+
const resultEntity = await nymph.getEntities(
|
|
386
396
|
{ class: TestModel },
|
|
387
397
|
{ type: '&', defined: 'string' }
|
|
388
398
|
);
|
|
@@ -393,7 +403,7 @@ This one's zip code is 92064.`;
|
|
|
393
403
|
await createTestEntities();
|
|
394
404
|
|
|
395
405
|
// Retrieving entity by !defined...
|
|
396
|
-
const resultEntity = await
|
|
406
|
+
const resultEntity = await nymph.getEntities(
|
|
397
407
|
{ class: TestModel },
|
|
398
408
|
{ type: '&', tag: 'test', '!defined': 'pickles' }
|
|
399
409
|
);
|
|
@@ -404,7 +414,7 @@ This one's zip code is 92064.`;
|
|
|
404
414
|
await createTestEntities();
|
|
405
415
|
|
|
406
416
|
// Retrieving entity by defined in not and clause...
|
|
407
|
-
const resultEntity = await
|
|
417
|
+
const resultEntity = await nymph.getEntities(
|
|
408
418
|
{ class: TestModel },
|
|
409
419
|
{ type: '!&', defined: 'pickles' },
|
|
410
420
|
{ type: '&', tag: 'test' }
|
|
@@ -416,7 +426,7 @@ This one's zip code is 92064.`;
|
|
|
416
426
|
await createTestEntities();
|
|
417
427
|
|
|
418
428
|
// Retrieving entity by equal...
|
|
419
|
-
const resultEntity = await
|
|
429
|
+
const resultEntity = await nymph.getEntities(
|
|
420
430
|
{ class: TestModel },
|
|
421
431
|
{ type: '&', equal: ['string', 'test'] }
|
|
422
432
|
);
|
|
@@ -430,7 +440,7 @@ This one's zip code is 92064.`;
|
|
|
430
440
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
431
441
|
|
|
432
442
|
// Retrieving entity by !equal...
|
|
433
|
-
const resultEntity = await
|
|
443
|
+
const resultEntity = await nymph.getEntities(
|
|
434
444
|
{ class: TestModel },
|
|
435
445
|
{ type: '&', tag: 'test', '!equal': ['string', 'wrong'] }
|
|
436
446
|
);
|
|
@@ -442,7 +452,7 @@ This one's zip code is 92064.`;
|
|
|
442
452
|
await createTestEntities();
|
|
443
453
|
|
|
444
454
|
// Retrieving entity by like...
|
|
445
|
-
const resultEntity = await
|
|
455
|
+
const resultEntity = await nymph.getEntities(
|
|
446
456
|
{ class: TestModel },
|
|
447
457
|
{ type: '&', like: ['string', 't_s%'] }
|
|
448
458
|
);
|
|
@@ -456,7 +466,7 @@ This one's zip code is 92064.`;
|
|
|
456
466
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
457
467
|
|
|
458
468
|
// Retrieving entity by !like...
|
|
459
|
-
const resultEntity = await
|
|
469
|
+
const resultEntity = await nymph.getEntities(
|
|
460
470
|
{ class: TestModel },
|
|
461
471
|
{ type: '&', tag: 'test', '!like': ['string', 'wr_n%'] }
|
|
462
472
|
);
|
|
@@ -468,7 +478,7 @@ This one's zip code is 92064.`;
|
|
|
468
478
|
await createTestEntities();
|
|
469
479
|
|
|
470
480
|
// Retrieving entity by ilike...
|
|
471
|
-
const resultEntity = await
|
|
481
|
+
const resultEntity = await nymph.getEntities(
|
|
472
482
|
{ class: TestModel },
|
|
473
483
|
{ type: '&', ilike: ['string', 'T_s%'] }
|
|
474
484
|
);
|
|
@@ -482,7 +492,7 @@ This one's zip code is 92064.`;
|
|
|
482
492
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
483
493
|
|
|
484
494
|
// Retrieving entity by !ilike...
|
|
485
|
-
const resultEntity = await
|
|
495
|
+
const resultEntity = await nymph.getEntities(
|
|
486
496
|
{ class: TestModel },
|
|
487
497
|
{ type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] }
|
|
488
498
|
);
|
|
@@ -494,7 +504,7 @@ This one's zip code is 92064.`;
|
|
|
494
504
|
await createTestEntities();
|
|
495
505
|
|
|
496
506
|
// Retrieving entity by like...
|
|
497
|
-
const resultEntity = await
|
|
507
|
+
const resultEntity = await nymph.getEntities(
|
|
498
508
|
{ class: TestModel },
|
|
499
509
|
{ type: '&', like: ['string', 'T_s%'] }
|
|
500
510
|
);
|
|
@@ -505,7 +515,7 @@ This one's zip code is 92064.`;
|
|
|
505
515
|
await createTestEntities();
|
|
506
516
|
|
|
507
517
|
// Retrieving entity by tags and equal...
|
|
508
|
-
const resultEntity = await
|
|
518
|
+
const resultEntity = await nymph.getEntities(
|
|
509
519
|
{ class: TestModel },
|
|
510
520
|
{ type: '&', tag: 'test', equal: ['string', 'test'] }
|
|
511
521
|
);
|
|
@@ -516,7 +526,7 @@ This one's zip code is 92064.`;
|
|
|
516
526
|
await createTestEntities();
|
|
517
527
|
|
|
518
528
|
// Testing wrong tags and right equal...
|
|
519
|
-
const resultEntity = await
|
|
529
|
+
const resultEntity = await nymph.getEntities(
|
|
520
530
|
{ class: TestModel },
|
|
521
531
|
{ type: '&', tag: 'pickles', equal: ['string', 'test'] }
|
|
522
532
|
);
|
|
@@ -527,7 +537,7 @@ This one's zip code is 92064.`;
|
|
|
527
537
|
await createTestEntities();
|
|
528
538
|
|
|
529
539
|
// Testing right tags and wrong equal...
|
|
530
|
-
const resultEntity = await
|
|
540
|
+
const resultEntity = await nymph.getEntities(
|
|
531
541
|
{ class: TestModel },
|
|
532
542
|
{ type: '&', tag: 'test', equal: ['string', 'pickles'] }
|
|
533
543
|
);
|
|
@@ -538,7 +548,7 @@ This one's zip code is 92064.`;
|
|
|
538
548
|
await createTestEntities();
|
|
539
549
|
|
|
540
550
|
// Testing wrong tags and wrong equal...
|
|
541
|
-
const resultEntity = await
|
|
551
|
+
const resultEntity = await nymph.getEntities(
|
|
542
552
|
{ class: TestModel },
|
|
543
553
|
{ type: '&', tag: 'pickles', equal: ['string', 'pickles'] }
|
|
544
554
|
);
|
|
@@ -549,14 +559,14 @@ This one's zip code is 92064.`;
|
|
|
549
559
|
await createTestEntities();
|
|
550
560
|
|
|
551
561
|
// Retrieving entity by contain...
|
|
552
|
-
let resultEntity = await
|
|
562
|
+
let resultEntity = await nymph.getEntities(
|
|
553
563
|
{ class: TestModel },
|
|
554
564
|
{ type: '&', contain: ['array', 'values'] }
|
|
555
565
|
);
|
|
556
566
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
557
567
|
|
|
558
568
|
// Retrieving entity by contain with full match...
|
|
559
|
-
resultEntity = await
|
|
569
|
+
resultEntity = await nymph.getEntities(
|
|
560
570
|
{ class: TestModel },
|
|
561
571
|
{ type: '&', contain: ['string', 'test'] }
|
|
562
572
|
);
|
|
@@ -567,7 +577,7 @@ This one's zip code is 92064.`;
|
|
|
567
577
|
await createTestEntities();
|
|
568
578
|
|
|
569
579
|
// Retrieving entity by !contain...
|
|
570
|
-
const resultEntity = await
|
|
580
|
+
const resultEntity = await nymph.getEntities(
|
|
571
581
|
{ class: TestModel },
|
|
572
582
|
{ type: '&', tag: 'test' },
|
|
573
583
|
{ type: '!&', contain: ['array', 'pickles'] }
|
|
@@ -579,14 +589,14 @@ This one's zip code is 92064.`;
|
|
|
579
589
|
await createTestEntities();
|
|
580
590
|
|
|
581
591
|
// Testing wrong contain...
|
|
582
|
-
let resultEntity = await
|
|
592
|
+
let resultEntity = await nymph.getEntities(
|
|
583
593
|
{ class: TestModel },
|
|
584
594
|
{ type: '&', contain: ['array', 'pickles'] }
|
|
585
595
|
);
|
|
586
596
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
587
597
|
|
|
588
598
|
// Testing wrong contain...
|
|
589
|
-
resultEntity = await
|
|
599
|
+
resultEntity = await nymph.getEntities(
|
|
590
600
|
{ class: TestModel },
|
|
591
601
|
{ type: '&', contain: ['string', 'pickles'] }
|
|
592
602
|
);
|
|
@@ -597,17 +607,17 @@ This one's zip code is 92064.`;
|
|
|
597
607
|
await createTestEntities();
|
|
598
608
|
|
|
599
609
|
// Retrieving entity by regex match...
|
|
600
|
-
let resultEntity = await
|
|
610
|
+
let resultEntity = await nymph.getEntities(
|
|
601
611
|
{ class: TestModel },
|
|
602
612
|
{ type: '&', match: ['match', '.*'] } // anything
|
|
603
613
|
);
|
|
604
614
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
605
|
-
resultEntity = await
|
|
615
|
+
resultEntity = await nymph.getEntities(
|
|
606
616
|
{ class: TestModel },
|
|
607
617
|
{ type: '&', tag: 'test', match: ['match', 'Edward McCheese'] } // a substring
|
|
608
618
|
);
|
|
609
619
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
610
|
-
resultEntity = await
|
|
620
|
+
resultEntity = await nymph.getEntities(
|
|
611
621
|
{ class: TestModel },
|
|
612
622
|
{ type: '&', tag: 'test' },
|
|
613
623
|
{
|
|
@@ -619,7 +629,7 @@ This one's zip code is 92064.`;
|
|
|
619
629
|
} // inclusive test
|
|
620
630
|
);
|
|
621
631
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
622
|
-
resultEntity = await
|
|
632
|
+
resultEntity = await nymph.getEntities(
|
|
623
633
|
{ class: TestModel },
|
|
624
634
|
{
|
|
625
635
|
type: '&',
|
|
@@ -628,7 +638,7 @@ This one's zip code is 92064.`;
|
|
|
628
638
|
} // a simple email
|
|
629
639
|
);
|
|
630
640
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
631
|
-
resultEntity = await
|
|
641
|
+
resultEntity = await nymph.getEntities(
|
|
632
642
|
{ class: TestModel },
|
|
633
643
|
{
|
|
634
644
|
type: '&',
|
|
@@ -643,7 +653,7 @@ This one's zip code is 92064.`;
|
|
|
643
653
|
await createTestEntities();
|
|
644
654
|
|
|
645
655
|
// Retrieving entity by regex match...
|
|
646
|
-
const resultEntity = await
|
|
656
|
+
const resultEntity = await nymph.getEntities(
|
|
647
657
|
{ class: TestModel },
|
|
648
658
|
{ type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] } // a substring
|
|
649
659
|
);
|
|
@@ -654,17 +664,17 @@ This one's zip code is 92064.`;
|
|
|
654
664
|
await createTestEntities();
|
|
655
665
|
|
|
656
666
|
// Testing wrong regex match...
|
|
657
|
-
let resultEntity = await
|
|
667
|
+
let resultEntity = await nymph.getEntities(
|
|
658
668
|
{ class: TestModel },
|
|
659
669
|
{ type: '&', match: ['match', 'Q'] }
|
|
660
670
|
);
|
|
661
671
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
662
|
-
resultEntity = await
|
|
672
|
+
resultEntity = await nymph.getEntities(
|
|
663
673
|
{ class: TestModel },
|
|
664
674
|
{ type: '&', tag: 'pickle', match: ['match', '.*'] }
|
|
665
675
|
);
|
|
666
676
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
667
|
-
resultEntity = await
|
|
677
|
+
resultEntity = await nymph.getEntities(
|
|
668
678
|
{ class: TestModel },
|
|
669
679
|
{
|
|
670
680
|
type: '|',
|
|
@@ -681,7 +691,7 @@ This one's zip code is 92064.`;
|
|
|
681
691
|
await createTestEntities();
|
|
682
692
|
|
|
683
693
|
// Retrieving entity by regex match...
|
|
684
|
-
const resultEntity = await
|
|
694
|
+
const resultEntity = await nymph.getEntities(
|
|
685
695
|
{ class: TestModel },
|
|
686
696
|
{ type: '&', tag: 'test', match: ['match', 'edward mccheese'] } // a substring
|
|
687
697
|
);
|
|
@@ -692,7 +702,7 @@ This one's zip code is 92064.`;
|
|
|
692
702
|
await createTestEntities();
|
|
693
703
|
|
|
694
704
|
// Retrieving entity by regex + equal inclusively...
|
|
695
|
-
const resultEntity = await
|
|
705
|
+
const resultEntity = await nymph.getEntities(
|
|
696
706
|
{ class: TestModel },
|
|
697
707
|
{ type: '&', tag: 'test' },
|
|
698
708
|
{ type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] }
|
|
@@ -704,7 +714,7 @@ This one's zip code is 92064.`;
|
|
|
704
714
|
await createTestEntities();
|
|
705
715
|
|
|
706
716
|
// Retrieving entity by inequality...
|
|
707
|
-
let resultEntity = await
|
|
717
|
+
let resultEntity = await nymph.getEntities(
|
|
708
718
|
{ class: TestModel },
|
|
709
719
|
{
|
|
710
720
|
type: '|',
|
|
@@ -717,7 +727,7 @@ This one's zip code is 92064.`;
|
|
|
717
727
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
718
728
|
|
|
719
729
|
// Retrieving entity by inequality...
|
|
720
|
-
resultEntity = await
|
|
730
|
+
resultEntity = await nymph.getEntities(
|
|
721
731
|
{ class: TestModel },
|
|
722
732
|
{
|
|
723
733
|
type: '|',
|
|
@@ -730,7 +740,7 @@ This one's zip code is 92064.`;
|
|
|
730
740
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
731
741
|
|
|
732
742
|
// Retrieving entity by inequality...
|
|
733
|
-
resultEntity = await
|
|
743
|
+
resultEntity = await nymph.getEntities(
|
|
734
744
|
{ class: TestModel },
|
|
735
745
|
{
|
|
736
746
|
type: '|',
|
|
@@ -743,7 +753,7 @@ This one's zip code is 92064.`;
|
|
|
743
753
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
744
754
|
|
|
745
755
|
// Retrieving entity by inequality...
|
|
746
|
-
resultEntity = await
|
|
756
|
+
resultEntity = await nymph.getEntities(
|
|
747
757
|
{ class: TestModel },
|
|
748
758
|
{
|
|
749
759
|
type: '|',
|
|
@@ -756,7 +766,7 @@ This one's zip code is 92064.`;
|
|
|
756
766
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
757
767
|
|
|
758
768
|
// Retrieving entity by inequality...
|
|
759
|
-
resultEntity = await
|
|
769
|
+
resultEntity = await nymph.getEntities(
|
|
760
770
|
{ class: TestModel },
|
|
761
771
|
{
|
|
762
772
|
type: '|',
|
|
@@ -769,7 +779,7 @@ This one's zip code is 92064.`;
|
|
|
769
779
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
770
780
|
|
|
771
781
|
// Retrieving entity by inequality...
|
|
772
|
-
resultEntity = await
|
|
782
|
+
resultEntity = await nymph.getEntities(
|
|
773
783
|
{ class: TestModel },
|
|
774
784
|
{
|
|
775
785
|
type: '|',
|
|
@@ -786,7 +796,7 @@ This one's zip code is 92064.`;
|
|
|
786
796
|
await createTestEntities();
|
|
787
797
|
|
|
788
798
|
// Retrieving entity by inequality...
|
|
789
|
-
let resultEntity = await
|
|
799
|
+
let resultEntity = await nymph.getEntities(
|
|
790
800
|
{ class: TestModel },
|
|
791
801
|
{
|
|
792
802
|
type: '|',
|
|
@@ -799,7 +809,7 @@ This one's zip code is 92064.`;
|
|
|
799
809
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
800
810
|
|
|
801
811
|
// Retrieving entity by inequality...
|
|
802
|
-
resultEntity = await
|
|
812
|
+
resultEntity = await nymph.getEntities(
|
|
803
813
|
{ class: TestModel },
|
|
804
814
|
{
|
|
805
815
|
type: '|',
|
|
@@ -812,7 +822,7 @@ This one's zip code is 92064.`;
|
|
|
812
822
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
813
823
|
|
|
814
824
|
// Retrieving entity by inequality...
|
|
815
|
-
resultEntity = await
|
|
825
|
+
resultEntity = await nymph.getEntities(
|
|
816
826
|
{ class: TestModel },
|
|
817
827
|
{
|
|
818
828
|
type: '|',
|
|
@@ -825,7 +835,7 @@ This one's zip code is 92064.`;
|
|
|
825
835
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
826
836
|
|
|
827
837
|
// Retrieving entity by inequality...
|
|
828
|
-
resultEntity = await
|
|
838
|
+
resultEntity = await nymph.getEntities(
|
|
829
839
|
{ class: TestModel },
|
|
830
840
|
{
|
|
831
841
|
type: '|',
|
|
@@ -838,7 +848,7 @@ This one's zip code is 92064.`;
|
|
|
838
848
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
839
849
|
|
|
840
850
|
// Retrieving entity by inequality...
|
|
841
|
-
resultEntity = await
|
|
851
|
+
resultEntity = await nymph.getEntities(
|
|
842
852
|
{ class: TestModel },
|
|
843
853
|
{
|
|
844
854
|
type: '|',
|
|
@@ -851,7 +861,7 @@ This one's zip code is 92064.`;
|
|
|
851
861
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
852
862
|
|
|
853
863
|
// Retrieving entity by inequality...
|
|
854
|
-
resultEntity = await
|
|
864
|
+
resultEntity = await nymph.getEntities(
|
|
855
865
|
{ class: TestModel },
|
|
856
866
|
{
|
|
857
867
|
type: '|',
|
|
@@ -868,7 +878,7 @@ This one's zip code is 92064.`;
|
|
|
868
878
|
await createTestEntities();
|
|
869
879
|
|
|
870
880
|
// Retrieving entity by inequality...
|
|
871
|
-
let resultEntity = await
|
|
881
|
+
let resultEntity = await nymph.getEntities(
|
|
872
882
|
{ class: TestModel },
|
|
873
883
|
{
|
|
874
884
|
type: '|',
|
|
@@ -881,7 +891,7 @@ This one's zip code is 92064.`;
|
|
|
881
891
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
882
892
|
|
|
883
893
|
// Retrieving entity by inequality...
|
|
884
|
-
resultEntity = await
|
|
894
|
+
resultEntity = await nymph.getEntities(
|
|
885
895
|
{ class: TestModel },
|
|
886
896
|
{
|
|
887
897
|
type: '|',
|
|
@@ -894,7 +904,7 @@ This one's zip code is 92064.`;
|
|
|
894
904
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
895
905
|
|
|
896
906
|
// Retrieving entity by inequality...
|
|
897
|
-
resultEntity = await
|
|
907
|
+
resultEntity = await nymph.getEntities(
|
|
898
908
|
{ class: TestModel },
|
|
899
909
|
{
|
|
900
910
|
type: '|',
|
|
@@ -907,7 +917,7 @@ This one's zip code is 92064.`;
|
|
|
907
917
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
908
918
|
|
|
909
919
|
// Retrieving entity by inequality...
|
|
910
|
-
resultEntity = await
|
|
920
|
+
resultEntity = await nymph.getEntities(
|
|
911
921
|
{ class: TestModel },
|
|
912
922
|
{
|
|
913
923
|
type: '|',
|
|
@@ -920,7 +930,7 @@ This one's zip code is 92064.`;
|
|
|
920
930
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
921
931
|
|
|
922
932
|
// Retrieving entity by inequality...
|
|
923
|
-
resultEntity = await
|
|
933
|
+
resultEntity = await nymph.getEntities(
|
|
924
934
|
{ class: TestModel },
|
|
925
935
|
{
|
|
926
936
|
type: '|',
|
|
@@ -933,7 +943,7 @@ This one's zip code is 92064.`;
|
|
|
933
943
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
934
944
|
|
|
935
945
|
// Retrieving entity by inequality...
|
|
936
|
-
resultEntity = await
|
|
946
|
+
resultEntity = await nymph.getEntities(
|
|
937
947
|
{ class: TestModel },
|
|
938
948
|
{
|
|
939
949
|
type: '|',
|
|
@@ -950,7 +960,7 @@ This one's zip code is 92064.`;
|
|
|
950
960
|
await createTestEntities();
|
|
951
961
|
|
|
952
962
|
// Retrieving entity by inequality...
|
|
953
|
-
let resultEntity = await
|
|
963
|
+
let resultEntity = await nymph.getEntities(
|
|
954
964
|
{ class: TestModel },
|
|
955
965
|
{
|
|
956
966
|
type: '|',
|
|
@@ -963,7 +973,7 @@ This one's zip code is 92064.`;
|
|
|
963
973
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
964
974
|
|
|
965
975
|
// Retrieving entity by inequality...
|
|
966
|
-
resultEntity = await
|
|
976
|
+
resultEntity = await nymph.getEntities(
|
|
967
977
|
{ class: TestModel },
|
|
968
978
|
{
|
|
969
979
|
type: '|',
|
|
@@ -976,7 +986,7 @@ This one's zip code is 92064.`;
|
|
|
976
986
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
977
987
|
|
|
978
988
|
// Retrieving entity by inequality...
|
|
979
|
-
resultEntity = await
|
|
989
|
+
resultEntity = await nymph.getEntities(
|
|
980
990
|
{ class: TestModel },
|
|
981
991
|
{
|
|
982
992
|
type: '|',
|
|
@@ -989,7 +999,7 @@ This one's zip code is 92064.`;
|
|
|
989
999
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
990
1000
|
|
|
991
1001
|
// Retrieving entity by inequality...
|
|
992
|
-
resultEntity = await
|
|
1002
|
+
resultEntity = await nymph.getEntities(
|
|
993
1003
|
{ class: TestModel },
|
|
994
1004
|
{
|
|
995
1005
|
type: '|',
|
|
@@ -1002,7 +1012,7 @@ This one's zip code is 92064.`;
|
|
|
1002
1012
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1003
1013
|
|
|
1004
1014
|
// Retrieving entity by inequality...
|
|
1005
|
-
resultEntity = await
|
|
1015
|
+
resultEntity = await nymph.getEntities(
|
|
1006
1016
|
{ class: TestModel },
|
|
1007
1017
|
{
|
|
1008
1018
|
type: '|',
|
|
@@ -1015,7 +1025,7 @@ This one's zip code is 92064.`;
|
|
|
1015
1025
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1016
1026
|
|
|
1017
1027
|
// Retrieving entity by inequality...
|
|
1018
|
-
resultEntity = await
|
|
1028
|
+
resultEntity = await nymph.getEntities(
|
|
1019
1029
|
{ class: TestModel },
|
|
1020
1030
|
{
|
|
1021
1031
|
type: '|',
|
|
@@ -1032,7 +1042,7 @@ This one's zip code is 92064.`;
|
|
|
1032
1042
|
await createTestEntities();
|
|
1033
1043
|
|
|
1034
1044
|
// Retrieving entity by !inequality...
|
|
1035
|
-
const resultEntity = await
|
|
1045
|
+
const resultEntity = await nymph.getEntities(
|
|
1036
1046
|
{ class: TestModel },
|
|
1037
1047
|
{ type: '&', tag: 'test' },
|
|
1038
1048
|
{ type: '!&', gte: ['number', 60] }
|
|
@@ -1044,7 +1054,7 @@ This one's zip code is 92064.`;
|
|
|
1044
1054
|
await createTestEntities();
|
|
1045
1055
|
|
|
1046
1056
|
// Testing wrong inequality...
|
|
1047
|
-
const resultEntity = await
|
|
1057
|
+
const resultEntity = await nymph.getEntities(
|
|
1048
1058
|
{ class: TestModel },
|
|
1049
1059
|
{ type: '&', lte: ['number', 29.99] }
|
|
1050
1060
|
);
|
|
@@ -1055,7 +1065,7 @@ This one's zip code is 92064.`;
|
|
|
1055
1065
|
await createTestEntities();
|
|
1056
1066
|
|
|
1057
1067
|
// Retrieving entity by time...
|
|
1058
|
-
const resultEntity = await
|
|
1068
|
+
const resultEntity = await nymph.getEntities(
|
|
1059
1069
|
{ class: TestModel },
|
|
1060
1070
|
{ type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] }
|
|
1061
1071
|
);
|
|
@@ -1066,7 +1076,7 @@ This one's zip code is 92064.`;
|
|
|
1066
1076
|
await createTestEntities();
|
|
1067
1077
|
|
|
1068
1078
|
// Testing wrong time...
|
|
1069
|
-
const resultEntity = await
|
|
1079
|
+
const resultEntity = await nymph.getEntities(
|
|
1070
1080
|
{ class: TestModel },
|
|
1071
1081
|
{ type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] }
|
|
1072
1082
|
);
|
|
@@ -1079,7 +1089,7 @@ This one's zip code is 92064.`;
|
|
|
1079
1089
|
const referenceEntity = await TestModel.factory(refGuid);
|
|
1080
1090
|
|
|
1081
1091
|
// Retrieving entity by relative time...
|
|
1082
|
-
let resultEntity = await
|
|
1092
|
+
let resultEntity = await nymph.getEntities(
|
|
1083
1093
|
{ class: TestModel },
|
|
1084
1094
|
{ type: '&', gt: ['timestamp', null, '-1 day'] }
|
|
1085
1095
|
);
|
|
@@ -1087,7 +1097,7 @@ This one's zip code is 92064.`;
|
|
|
1087
1097
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
1088
1098
|
|
|
1089
1099
|
// Retrieving entity by relative time inclusively...
|
|
1090
|
-
resultEntity = await
|
|
1100
|
+
resultEntity = await nymph.getEntities(
|
|
1091
1101
|
{ class: TestModel },
|
|
1092
1102
|
{
|
|
1093
1103
|
type: '|',
|
|
@@ -1101,7 +1111,7 @@ This one's zip code is 92064.`;
|
|
|
1101
1111
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
1102
1112
|
|
|
1103
1113
|
// Retrieving entity by relative time...
|
|
1104
|
-
resultEntity = await
|
|
1114
|
+
resultEntity = await nymph.getEntities(
|
|
1105
1115
|
{ class: TestModel },
|
|
1106
1116
|
{ type: '&', gt: ['timestamp', null, '-3 days'] }
|
|
1107
1117
|
);
|
|
@@ -1109,7 +1119,7 @@ This one's zip code is 92064.`;
|
|
|
1109
1119
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
1110
1120
|
|
|
1111
1121
|
// Retrieving entity by relative time...
|
|
1112
|
-
resultEntity = await
|
|
1122
|
+
resultEntity = await nymph.getEntities(
|
|
1113
1123
|
{ class: TestModel },
|
|
1114
1124
|
{ type: '&', gt: ['cdate', null, '-1 day'] }
|
|
1115
1125
|
);
|
|
@@ -1123,7 +1133,7 @@ This one's zip code is 92064.`;
|
|
|
1123
1133
|
const referenceEntity = await TestModel.factory(refGuid);
|
|
1124
1134
|
|
|
1125
1135
|
// Retrieving entity by relative time...
|
|
1126
|
-
let resultEntity = await
|
|
1136
|
+
let resultEntity = await nymph.getEntities(
|
|
1127
1137
|
{ class: TestModel },
|
|
1128
1138
|
{ type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] }
|
|
1129
1139
|
);
|
|
@@ -1131,7 +1141,7 @@ This one's zip code is 92064.`;
|
|
|
1131
1141
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
1132
1142
|
|
|
1133
1143
|
// Retrieving entity by relative time...
|
|
1134
|
-
resultEntity = await
|
|
1144
|
+
resultEntity = await nymph.getEntities(
|
|
1135
1145
|
{ class: TestModel },
|
|
1136
1146
|
{ type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] }
|
|
1137
1147
|
);
|
|
@@ -1139,7 +1149,7 @@ This one's zip code is 92064.`;
|
|
|
1139
1149
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
1140
1150
|
|
|
1141
1151
|
// Retrieving entity by relative time...
|
|
1142
|
-
resultEntity = await
|
|
1152
|
+
resultEntity = await nymph.getEntities(
|
|
1143
1153
|
{ class: TestModel },
|
|
1144
1154
|
{ type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] }
|
|
1145
1155
|
);
|
|
@@ -1161,7 +1171,7 @@ This one's zip code is 92064.`;
|
|
|
1161
1171
|
await createTestEntities();
|
|
1162
1172
|
|
|
1163
1173
|
// Retrieving entity by reference...
|
|
1164
|
-
const resultEntity = await
|
|
1174
|
+
const resultEntity = await nymph.getEntities(
|
|
1165
1175
|
{ class: TestModel },
|
|
1166
1176
|
{ type: '&', ref: ['reference', refGuid] }
|
|
1167
1177
|
);
|
|
@@ -1172,7 +1182,7 @@ This one's zip code is 92064.`;
|
|
|
1172
1182
|
await createTestEntities();
|
|
1173
1183
|
|
|
1174
1184
|
// Retrieving entity by !reference...
|
|
1175
|
-
const resultEntity = await
|
|
1185
|
+
const resultEntity = await nymph.getEntities(
|
|
1176
1186
|
{ class: TestModel },
|
|
1177
1187
|
{ type: '&', tag: 'test' },
|
|
1178
1188
|
{ type: '!&', ref: ['reference', newGUID()] }
|
|
@@ -1184,7 +1194,7 @@ This one's zip code is 92064.`;
|
|
|
1184
1194
|
await createTestEntities();
|
|
1185
1195
|
|
|
1186
1196
|
// Testing wrong reference...
|
|
1187
|
-
const resultEntity = await
|
|
1197
|
+
const resultEntity = await nymph.getEntities(
|
|
1188
1198
|
{ class: TestModel },
|
|
1189
1199
|
{ type: '&', ref: ['reference', newGUID()] }
|
|
1190
1200
|
);
|
|
@@ -1195,7 +1205,7 @@ This one's zip code is 92064.`;
|
|
|
1195
1205
|
await createTestEntities();
|
|
1196
1206
|
|
|
1197
1207
|
// Testing non-existent reference...
|
|
1198
|
-
const resultEntity = await
|
|
1208
|
+
const resultEntity = await nymph.getEntities(
|
|
1199
1209
|
{ class: TestModel },
|
|
1200
1210
|
{ type: '&', ref: ['pickle', refGuid] }
|
|
1201
1211
|
);
|
|
@@ -1206,7 +1216,7 @@ This one's zip code is 92064.`;
|
|
|
1206
1216
|
await createTestEntities();
|
|
1207
1217
|
|
|
1208
1218
|
// Retrieving entity by inclusive reference...
|
|
1209
|
-
const resultEntity = await
|
|
1219
|
+
const resultEntity = await nymph.getEntities(
|
|
1210
1220
|
{ class: TestModel },
|
|
1211
1221
|
{
|
|
1212
1222
|
type: '|',
|
|
@@ -1223,7 +1233,7 @@ This one's zip code is 92064.`;
|
|
|
1223
1233
|
await createTestEntities();
|
|
1224
1234
|
|
|
1225
1235
|
// Testing wrong inclusive reference...
|
|
1226
|
-
const resultEntity = await
|
|
1236
|
+
const resultEntity = await nymph.getEntities(
|
|
1227
1237
|
{ class: TestModel },
|
|
1228
1238
|
{
|
|
1229
1239
|
type: '|',
|
|
@@ -1240,7 +1250,7 @@ This one's zip code is 92064.`;
|
|
|
1240
1250
|
await createTestEntities();
|
|
1241
1251
|
|
|
1242
1252
|
// Retrieving entity by array reference...
|
|
1243
|
-
const resultEntity = await
|
|
1253
|
+
const resultEntity = await nymph.getEntities(
|
|
1244
1254
|
{ class: TestModel },
|
|
1245
1255
|
{ type: '&', ref: ['refArray', refGuid] }
|
|
1246
1256
|
);
|
|
@@ -1251,7 +1261,7 @@ This one's zip code is 92064.`;
|
|
|
1251
1261
|
await createTestEntities();
|
|
1252
1262
|
|
|
1253
1263
|
// Testing wrong array reference...
|
|
1254
|
-
const resultEntity = await
|
|
1264
|
+
const resultEntity = await nymph.getEntities(
|
|
1255
1265
|
{ class: TestModel },
|
|
1256
1266
|
{
|
|
1257
1267
|
type: '&',
|
|
@@ -1268,7 +1278,7 @@ This one's zip code is 92064.`;
|
|
|
1268
1278
|
await createTestEntities();
|
|
1269
1279
|
|
|
1270
1280
|
// Testing logic operations...
|
|
1271
|
-
const resultEntity = await
|
|
1281
|
+
const resultEntity = await nymph.getEntities(
|
|
1272
1282
|
{ class: TestModel },
|
|
1273
1283
|
{
|
|
1274
1284
|
type: '&',
|
|
@@ -1309,11 +1319,56 @@ This one's zip code is 92064.`;
|
|
|
1309
1319
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1310
1320
|
});
|
|
1311
1321
|
|
|
1322
|
+
it('guid return', async () => {
|
|
1323
|
+
await createTestEntities();
|
|
1324
|
+
|
|
1325
|
+
// Testing guid return using logic operations...
|
|
1326
|
+
const resultGuid = await nymph.getEntities(
|
|
1327
|
+
{ class: TestModel, return: 'guid' },
|
|
1328
|
+
{
|
|
1329
|
+
type: '&',
|
|
1330
|
+
'!ref': [
|
|
1331
|
+
['refArray', newGUID()],
|
|
1332
|
+
['refArray', newGUID()],
|
|
1333
|
+
],
|
|
1334
|
+
'!lte': ['number', 29.99],
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
type: '|',
|
|
1338
|
+
'!lte': [
|
|
1339
|
+
['number', 29.99],
|
|
1340
|
+
['number', 30],
|
|
1341
|
+
],
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
type: '!&',
|
|
1345
|
+
'!equal': ['string', 'test'],
|
|
1346
|
+
'!contain': [
|
|
1347
|
+
['array', 'full'],
|
|
1348
|
+
['array', 'of'],
|
|
1349
|
+
['array', 'values'],
|
|
1350
|
+
['array', 500],
|
|
1351
|
+
],
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
type: '!|',
|
|
1355
|
+
'!equal': ['string', 'test'],
|
|
1356
|
+
contain: [
|
|
1357
|
+
['array', 'full'],
|
|
1358
|
+
['array', 'of'],
|
|
1359
|
+
['array', 'values'],
|
|
1360
|
+
['array', 500],
|
|
1361
|
+
],
|
|
1362
|
+
}
|
|
1363
|
+
);
|
|
1364
|
+
expect(resultGuid.indexOf(testEntity.guid ?? '')).toBeGreaterThan(-1);
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1312
1367
|
it('deep selector', async () => {
|
|
1313
1368
|
await createTestEntities();
|
|
1314
1369
|
|
|
1315
1370
|
// Testing deep selectors...
|
|
1316
|
-
const resultEntity = await
|
|
1371
|
+
const resultEntity = await nymph.getEntities(
|
|
1317
1372
|
{ class: TestModel },
|
|
1318
1373
|
{
|
|
1319
1374
|
type: '&',
|
|
@@ -1358,7 +1413,7 @@ This one's zip code is 92064.`;
|
|
|
1358
1413
|
);
|
|
1359
1414
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1360
1415
|
|
|
1361
|
-
const resultEntity2 = await
|
|
1416
|
+
const resultEntity2 = await nymph.getEntities(
|
|
1362
1417
|
{ class: TestModel },
|
|
1363
1418
|
{
|
|
1364
1419
|
type: '&',
|
|
@@ -1403,7 +1458,7 @@ This one's zip code is 92064.`;
|
|
|
1403
1458
|
);
|
|
1404
1459
|
expect(testEntity.$inArray(resultEntity2)).toEqual(true);
|
|
1405
1460
|
|
|
1406
|
-
const resultEntity3 = await
|
|
1461
|
+
const resultEntity3 = await nymph.getEntities(
|
|
1407
1462
|
{ class: TestModel },
|
|
1408
1463
|
{
|
|
1409
1464
|
type: '|',
|
|
@@ -1419,7 +1474,7 @@ This one's zip code is 92064.`;
|
|
|
1419
1474
|
);
|
|
1420
1475
|
expect(testEntity.$inArray(resultEntity3)).toEqual(true);
|
|
1421
1476
|
|
|
1422
|
-
const resultEntity4 = await
|
|
1477
|
+
const resultEntity4 = await nymph.getEntities(
|
|
1423
1478
|
{ class: TestModel },
|
|
1424
1479
|
{
|
|
1425
1480
|
type: '|',
|
|
@@ -1444,7 +1499,7 @@ This one's zip code is 92064.`;
|
|
|
1444
1499
|
|
|
1445
1500
|
it('wrong deep selector', async () => {
|
|
1446
1501
|
// Testing wrong deep selectors...
|
|
1447
|
-
const resultEntity = await
|
|
1502
|
+
const resultEntity = await nymph.getEntities(
|
|
1448
1503
|
{ class: TestModel },
|
|
1449
1504
|
{
|
|
1450
1505
|
type: '&',
|
|
@@ -1461,12 +1516,80 @@ This one's zip code is 92064.`;
|
|
|
1461
1516
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1462
1517
|
});
|
|
1463
1518
|
|
|
1519
|
+
it('qref', async () => {
|
|
1520
|
+
await createTestEntities();
|
|
1521
|
+
|
|
1522
|
+
// Retrieving entity by qref...
|
|
1523
|
+
const resultEntity = await nymph.getEntities(
|
|
1524
|
+
{ class: TestModel },
|
|
1525
|
+
{
|
|
1526
|
+
type: '&',
|
|
1527
|
+
qref: [
|
|
1528
|
+
'reference',
|
|
1529
|
+
[{ class: TestModel }, { type: '&', equal: ['test', 'good'] }],
|
|
1530
|
+
],
|
|
1531
|
+
}
|
|
1532
|
+
);
|
|
1533
|
+
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
it('not qref', async () => {
|
|
1537
|
+
await createTestEntities();
|
|
1538
|
+
|
|
1539
|
+
// Retrieving entity by !qref...
|
|
1540
|
+
const resultEntity = await nymph.getEntities(
|
|
1541
|
+
{ class: TestModel },
|
|
1542
|
+
{
|
|
1543
|
+
type: '&',
|
|
1544
|
+
'!qref': [
|
|
1545
|
+
'reference',
|
|
1546
|
+
[{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
|
|
1547
|
+
],
|
|
1548
|
+
}
|
|
1549
|
+
);
|
|
1550
|
+
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1553
|
+
it('wrong qref class', async () => {
|
|
1554
|
+
await createTestEntities();
|
|
1555
|
+
|
|
1556
|
+
// Testing wrong qref...
|
|
1557
|
+
const resultEntity = await nymph.getEntities(
|
|
1558
|
+
{ class: TestModel },
|
|
1559
|
+
{
|
|
1560
|
+
type: '&',
|
|
1561
|
+
qref: [
|
|
1562
|
+
'reference',
|
|
1563
|
+
[{ class: TestBModel }, { type: '&', equal: ['test', 'good'] }],
|
|
1564
|
+
],
|
|
1565
|
+
}
|
|
1566
|
+
);
|
|
1567
|
+
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1568
|
+
});
|
|
1569
|
+
|
|
1570
|
+
it('wrong qref data', async () => {
|
|
1571
|
+
await createTestEntities();
|
|
1572
|
+
|
|
1573
|
+
// Testing wrong qref...
|
|
1574
|
+
const resultEntity = await nymph.getEntities(
|
|
1575
|
+
{ class: TestModel },
|
|
1576
|
+
{
|
|
1577
|
+
type: '&',
|
|
1578
|
+
qref: [
|
|
1579
|
+
'reference',
|
|
1580
|
+
[{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
|
|
1581
|
+
],
|
|
1582
|
+
}
|
|
1583
|
+
);
|
|
1584
|
+
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1585
|
+
});
|
|
1586
|
+
|
|
1464
1587
|
it('sort option', async () => {
|
|
1465
1588
|
await createMultipleTestEntities();
|
|
1466
1589
|
|
|
1467
1590
|
for (const sort of ['cdate', 'mdate']) {
|
|
1468
1591
|
// Retrieving entities sorted...
|
|
1469
|
-
let resultEntities = await
|
|
1592
|
+
let resultEntities = await nymph.getEntities({
|
|
1470
1593
|
class: TestModel,
|
|
1471
1594
|
sort: sort as 'cdate' | 'mdate',
|
|
1472
1595
|
});
|
|
@@ -1477,8 +1600,19 @@ This one's zip code is 92064.`;
|
|
|
1477
1600
|
).toBeGreaterThan(resultEntities[i][sort as 'cdate' | 'mdate'] ?? 0);
|
|
1478
1601
|
}
|
|
1479
1602
|
|
|
1603
|
+
// And test the same with guid return...
|
|
1604
|
+
let resultGuids = await nymph.getEntities({
|
|
1605
|
+
class: TestModel,
|
|
1606
|
+
sort: sort as 'cdate' | 'mdate',
|
|
1607
|
+
return: 'guid',
|
|
1608
|
+
});
|
|
1609
|
+
expect(resultGuids.length).toBeGreaterThan(100);
|
|
1610
|
+
for (let i = 0; i < resultGuids.length - 1; i++) {
|
|
1611
|
+
expect(resultGuids[i]).toEqual(resultEntities[i].guid);
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1480
1614
|
// Retrieving entities reverse sorted...
|
|
1481
|
-
resultEntities = await
|
|
1615
|
+
resultEntities = await nymph.getEntities({
|
|
1482
1616
|
class: TestModel,
|
|
1483
1617
|
sort: sort as 'cdate' | 'mdate',
|
|
1484
1618
|
reverse: true,
|
|
@@ -1492,7 +1626,7 @@ This one's zip code is 92064.`;
|
|
|
1492
1626
|
|
|
1493
1627
|
// And again with other selectors.
|
|
1494
1628
|
// Retrieving entities sorted...
|
|
1495
|
-
resultEntities = await
|
|
1629
|
+
resultEntities = await nymph.getEntities(
|
|
1496
1630
|
{ class: TestModel, sort: sort as 'cdate' | 'mdate' },
|
|
1497
1631
|
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1498
1632
|
);
|
|
@@ -1504,7 +1638,7 @@ This one's zip code is 92064.`;
|
|
|
1504
1638
|
}
|
|
1505
1639
|
|
|
1506
1640
|
// Retrieving entities reverse sorted...
|
|
1507
|
-
resultEntities = await
|
|
1641
|
+
resultEntities = await nymph.getEntities(
|
|
1508
1642
|
{ class: TestModel, sort: sort as 'cdate' | 'mdate', reverse: true },
|
|
1509
1643
|
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1510
1644
|
);
|
|
@@ -1532,7 +1666,7 @@ This one's zip code is 92064.`;
|
|
|
1532
1666
|
expect(await testEntity.$delete()).toEqual(true);
|
|
1533
1667
|
expect(testEntity.guid).toBeNull();
|
|
1534
1668
|
|
|
1535
|
-
const entity = await
|
|
1669
|
+
const entity = await nymph.getEntity(
|
|
1536
1670
|
{ class: TestModel },
|
|
1537
1671
|
{ type: '&', guid: testGuid }
|
|
1538
1672
|
);
|
|
@@ -1541,74 +1675,86 @@ This one's zip code is 92064.`;
|
|
|
1541
1675
|
});
|
|
1542
1676
|
}
|
|
1543
1677
|
|
|
1544
|
-
export function UIDTest(
|
|
1678
|
+
export function UIDTest(
|
|
1679
|
+
nymph: Nymph,
|
|
1680
|
+
it: (name: string, fn: () => void) => void
|
|
1681
|
+
) {
|
|
1682
|
+
nymph.addEntityClass(TestModel);
|
|
1683
|
+
nymph.addEntityClass(TestBModel);
|
|
1684
|
+
|
|
1545
1685
|
it('delete old test data', async () => {
|
|
1546
|
-
expect(await
|
|
1547
|
-
expect(await
|
|
1686
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1687
|
+
expect(await nymph.deleteUID('NewUID')).toEqual(true);
|
|
1548
1688
|
});
|
|
1549
1689
|
|
|
1550
1690
|
it('new UID', async () => {
|
|
1551
|
-
expect(await
|
|
1691
|
+
expect(await nymph.newUID('TestUID')).toEqual(1);
|
|
1552
1692
|
});
|
|
1553
1693
|
|
|
1554
1694
|
it('increment UID', async () => {
|
|
1555
|
-
expect(await
|
|
1695
|
+
expect(await nymph.newUID('TestUID')).toEqual(2);
|
|
1556
1696
|
});
|
|
1557
1697
|
|
|
1558
1698
|
it('retrieve UID', async () => {
|
|
1559
|
-
expect(await
|
|
1699
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1560
1700
|
});
|
|
1561
1701
|
|
|
1562
1702
|
it('rename UID', async () => {
|
|
1563
|
-
expect(await
|
|
1564
|
-
expect(await
|
|
1565
|
-
expect(await
|
|
1566
|
-
expect(await
|
|
1567
|
-
expect(await
|
|
1568
|
-
expect(await
|
|
1703
|
+
expect(await nymph.renameUID('TestUID', 'NewUID')).toEqual(true);
|
|
1704
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1705
|
+
expect(await nymph.getUID('NewUID')).toEqual(2);
|
|
1706
|
+
expect(await nymph.renameUID('NewUID', 'TestUID')).toEqual(true);
|
|
1707
|
+
expect(await nymph.getUID('NewUID')).toBeNull();
|
|
1708
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1569
1709
|
});
|
|
1570
1710
|
|
|
1571
1711
|
it('set UID', async () => {
|
|
1572
|
-
expect(await
|
|
1573
|
-
expect(await
|
|
1712
|
+
expect(await nymph.setUID('TestUID', 5)).toEqual(true);
|
|
1713
|
+
expect(await nymph.getUID('TestUID')).toEqual(5);
|
|
1574
1714
|
});
|
|
1575
1715
|
|
|
1576
1716
|
it('delete UID', async () => {
|
|
1577
|
-
expect(await
|
|
1578
|
-
expect(await
|
|
1717
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1718
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1579
1719
|
});
|
|
1580
1720
|
}
|
|
1581
1721
|
|
|
1582
|
-
export function ExportImportTest(
|
|
1722
|
+
export function ExportImportTest(
|
|
1723
|
+
nymph: Nymph,
|
|
1724
|
+
it: (name: string, fn: () => void) => void
|
|
1725
|
+
) {
|
|
1726
|
+
nymph.addEntityClass(TestModel);
|
|
1727
|
+
nymph.addEntityClass(TestBModel);
|
|
1728
|
+
|
|
1583
1729
|
async function deleteTestData() {
|
|
1584
|
-
let all = await
|
|
1730
|
+
let all = await nymph.getEntities({ class: TestModel });
|
|
1585
1731
|
expect(Array.isArray(all)).toEqual(true);
|
|
1586
1732
|
for (const cur of all) {
|
|
1587
1733
|
expect(await cur.$delete()).toEqual(true);
|
|
1588
1734
|
}
|
|
1589
1735
|
|
|
1590
|
-
all = await
|
|
1736
|
+
all = await nymph.getEntities({ class: TestModel });
|
|
1591
1737
|
expect(all.length).toEqual(0);
|
|
1592
1738
|
|
|
1593
|
-
all = await
|
|
1739
|
+
all = await nymph.getEntities({ class: TestBModel });
|
|
1594
1740
|
expect(Array.isArray(all)).toEqual(true);
|
|
1595
1741
|
for (const cur of all) {
|
|
1596
1742
|
expect(await cur.$delete()).toEqual(true);
|
|
1597
1743
|
}
|
|
1598
1744
|
|
|
1599
|
-
all = await
|
|
1745
|
+
all = await nymph.getEntities({ class: TestBModel });
|
|
1600
1746
|
expect(all.length).toEqual(0);
|
|
1601
1747
|
|
|
1602
|
-
expect(await
|
|
1603
|
-
expect(await
|
|
1748
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1749
|
+
expect(await nymph.deleteUID('TestUID2')).toEqual(true);
|
|
1604
1750
|
}
|
|
1605
1751
|
|
|
1606
1752
|
async function checkEntityDataAndCount() {
|
|
1607
|
-
expect(await
|
|
1608
|
-
expect(await
|
|
1753
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1754
|
+
expect(await nymph.getUID('TestUID2')).toEqual(1);
|
|
1609
1755
|
|
|
1610
|
-
const models = await
|
|
1611
|
-
const bmodels = await
|
|
1756
|
+
const models = await nymph.getEntities({ class: TestModel });
|
|
1757
|
+
const bmodels = await nymph.getEntities({ class: TestBModel });
|
|
1612
1758
|
|
|
1613
1759
|
expect(models.length).toEqual(30);
|
|
1614
1760
|
expect(bmodels.length).toEqual(10);
|
|
@@ -1636,9 +1782,9 @@ export function ExportImportTest(it: (name: string, fn: () => void) => void) {
|
|
|
1636
1782
|
});
|
|
1637
1783
|
|
|
1638
1784
|
it('setup data', async () => {
|
|
1639
|
-
expect(await
|
|
1640
|
-
expect(await
|
|
1641
|
-
expect(await
|
|
1785
|
+
expect(await nymph.newUID('TestUID')).toEqual(1);
|
|
1786
|
+
expect(await nymph.newUID('TestUID')).toEqual(2);
|
|
1787
|
+
expect(await nymph.newUID('TestUID2')).toEqual(1);
|
|
1642
1788
|
|
|
1643
1789
|
for (let i = 0; i < 20; i++) {
|
|
1644
1790
|
const EntityClass = i < 15 ? TestModel : TestBModel;
|
|
@@ -1670,7 +1816,7 @@ export function ExportImportTest(it: (name: string, fn: () => void) => void) {
|
|
|
1670
1816
|
});
|
|
1671
1817
|
|
|
1672
1818
|
it('export data', async () => {
|
|
1673
|
-
expect(await
|
|
1819
|
+
expect(await nymph.export(__dirname + '/testentityexport.nex')).toEqual(
|
|
1674
1820
|
true
|
|
1675
1821
|
);
|
|
1676
1822
|
});
|
|
@@ -1680,14 +1826,14 @@ export function ExportImportTest(it: (name: string, fn: () => void) => void) {
|
|
|
1680
1826
|
});
|
|
1681
1827
|
|
|
1682
1828
|
it('import data', async () => {
|
|
1683
|
-
expect(await
|
|
1684
|
-
expect(await
|
|
1685
|
-
const models = await
|
|
1686
|
-
const bmodels = await
|
|
1829
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1830
|
+
expect(await nymph.getUID('TestUID2')).toBeNull();
|
|
1831
|
+
const models = await nymph.getEntities({ class: TestModel });
|
|
1832
|
+
const bmodels = await nymph.getEntities({ class: TestBModel });
|
|
1687
1833
|
expect(models.length).toEqual(0);
|
|
1688
1834
|
expect(bmodels.length).toEqual(0);
|
|
1689
1835
|
|
|
1690
|
-
expect(await
|
|
1836
|
+
expect(await nymph.import(__dirname + '/testentityexport.nex')).toEqual(
|
|
1691
1837
|
true
|
|
1692
1838
|
);
|
|
1693
1839
|
|