@nymphjs/nymph 1.0.0-beta.46 → 1.0.0-beta.48
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 +8 -0
- package/README.md +3 -3
- package/package.json +12 -12
- package/src/Entity.test.ts +2 -2
- package/src/Entity.ts +26 -26
- package/src/Nymph.ts +9 -9
- package/src/Nymph.types.ts +33 -33
- package/src/driver/NymphDriver.ts +50 -50
- package/src/driver/testArtifacts.ts +125 -125
- package/src/nymphJoiProps.ts +2 -2
- package/src/testArtifacts.ts +1 -1
- package/src/testMocks.ts +5 -5
- package/src/utils.ts +4 -4
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export function QueriesTest(
|
|
14
14
|
nymph: Nymph,
|
|
15
|
-
it: (name: string, fn: () => void) => void
|
|
15
|
+
it: (name: string, fn: () => void) => void,
|
|
16
16
|
) {
|
|
17
17
|
const TestModel = nymph.addEntityClass(TestModelClass);
|
|
18
18
|
const TestBModel = nymph.addEntityClass(TestBModelClass);
|
|
@@ -67,7 +67,7 @@ These hats are absolutely fantastic.`;
|
|
|
67
67
|
// Test asynchronous getEntity.
|
|
68
68
|
testEntity = (await nymph.getEntity(
|
|
69
69
|
{ class: TestModel },
|
|
70
|
-
testGuid
|
|
70
|
+
testGuid,
|
|
71
71
|
)) as TestModelClass & TestModelData;
|
|
72
72
|
expect(testEntity).toBeInstanceOf(TestModel);
|
|
73
73
|
expect(testEntity.guid).toEqual(testGuid);
|
|
@@ -156,7 +156,7 @@ These hats are absolutely fantastic.`;
|
|
|
156
156
|
|
|
157
157
|
if (!(await transaction.inTransaction())) {
|
|
158
158
|
console.log(
|
|
159
|
-
'This Nymph driver or database seems to not support transactions. Skipping transaction tests.'
|
|
159
|
+
'This Nymph driver or database seems to not support transactions. Skipping transaction tests.',
|
|
160
160
|
);
|
|
161
161
|
await transaction.rollback('test');
|
|
162
162
|
return;
|
|
@@ -187,7 +187,7 @@ These hats are absolutely fantastic.`;
|
|
|
187
187
|
expect(await testEntity.$delete()).toEqual(true);
|
|
188
188
|
const resultEntity = await transaction.getEntity(
|
|
189
189
|
{ class: TestModel },
|
|
190
|
-
testGuid
|
|
190
|
+
testGuid,
|
|
191
191
|
);
|
|
192
192
|
expect(resultEntity).toBeNull();
|
|
193
193
|
|
|
@@ -200,7 +200,7 @@ These hats are absolutely fantastic.`;
|
|
|
200
200
|
// Verify it's back.
|
|
201
201
|
testEntity = (await transaction.getEntity(
|
|
202
202
|
{ class: TestModel },
|
|
203
|
-
testGuid
|
|
203
|
+
testGuid,
|
|
204
204
|
)) as TestModelClass & TestModelData;
|
|
205
205
|
|
|
206
206
|
expect(testEntity.guid).toEqual(testGuid);
|
|
@@ -246,7 +246,7 @@ These hats are absolutely fantastic.`;
|
|
|
246
246
|
limit: 1,
|
|
247
247
|
sort: 'cdate',
|
|
248
248
|
},
|
|
249
|
-
{ type: '&', tag: 'test' }
|
|
249
|
+
{ type: '&', tag: 'test' },
|
|
250
250
|
);
|
|
251
251
|
expect(resultEntities.length).toEqual(1);
|
|
252
252
|
expect(testEntity.$is(resultEntities[0])).toEqual(true);
|
|
@@ -258,7 +258,7 @@ These hats are absolutely fantastic.`;
|
|
|
258
258
|
// Retrieving entity by GUID and tags...
|
|
259
259
|
const resultEntity = await nymph.getEntity(
|
|
260
260
|
{ class: TestModel },
|
|
261
|
-
{ type: '&', guid: testGuid, tag: 'test' }
|
|
261
|
+
{ type: '&', guid: testGuid, tag: 'test' },
|
|
262
262
|
);
|
|
263
263
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
264
264
|
});
|
|
@@ -269,7 +269,7 @@ These hats are absolutely fantastic.`;
|
|
|
269
269
|
// Retrieving entity by GUID and tags...
|
|
270
270
|
const resultEntity = await nymph.getEntity(
|
|
271
271
|
{ class: TestModel },
|
|
272
|
-
{ type: '|', guid: [testGuid, guid()] }
|
|
272
|
+
{ type: '|', guid: [testGuid, guid()] },
|
|
273
273
|
);
|
|
274
274
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
275
275
|
});
|
|
@@ -280,7 +280,7 @@ These hats are absolutely fantastic.`;
|
|
|
280
280
|
// Retrieving entity by GUID and tags...
|
|
281
281
|
const resultEntity = await nymph.getEntity(
|
|
282
282
|
{ class: TestModel },
|
|
283
|
-
{ type: '|', guid: [guid(), guid()] }
|
|
283
|
+
{ type: '|', guid: [guid(), guid()] },
|
|
284
284
|
);
|
|
285
285
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
286
286
|
});
|
|
@@ -291,7 +291,7 @@ These hats are absolutely fantastic.`;
|
|
|
291
291
|
// Retrieving entity by !GUID...
|
|
292
292
|
const resultEntity = await nymph.getEntities(
|
|
293
293
|
{ class: TestModel },
|
|
294
|
-
{ type: '&', '!guid': guid(), tag: 'test' }
|
|
294
|
+
{ type: '&', '!guid': guid(), tag: 'test' },
|
|
295
295
|
);
|
|
296
296
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
297
297
|
});
|
|
@@ -302,7 +302,7 @@ These hats are absolutely fantastic.`;
|
|
|
302
302
|
// Retrieving entity by !tags...
|
|
303
303
|
const resultEntity = await nymph.getEntities(
|
|
304
304
|
{ class: TestModel },
|
|
305
|
-
{ type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] }
|
|
305
|
+
{ type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] },
|
|
306
306
|
);
|
|
307
307
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
308
308
|
});
|
|
@@ -313,7 +313,7 @@ These hats are absolutely fantastic.`;
|
|
|
313
313
|
// Testing GUID and wrong tags...
|
|
314
314
|
const resultEntity = await nymph.getEntity(
|
|
315
315
|
{ class: TestModel },
|
|
316
|
-
{ type: '&', guid: testGuid, tag: ['pickles'] }
|
|
316
|
+
{ type: '&', guid: testGuid, tag: ['pickles'] },
|
|
317
317
|
);
|
|
318
318
|
expect(resultEntity).toBeNull();
|
|
319
319
|
});
|
|
@@ -324,7 +324,7 @@ These hats are absolutely fantastic.`;
|
|
|
324
324
|
// Retrieving entity by tags...
|
|
325
325
|
const resultEntity = await nymph.getEntities(
|
|
326
326
|
{ class: TestModel },
|
|
327
|
-
{ type: '&', tag: 'test' }
|
|
327
|
+
{ type: '&', tag: 'test' },
|
|
328
328
|
);
|
|
329
329
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
330
330
|
});
|
|
@@ -335,7 +335,7 @@ These hats are absolutely fantastic.`;
|
|
|
335
335
|
// Testing wrong tags...
|
|
336
336
|
const resultEntity = await nymph.getEntities(
|
|
337
337
|
{ class: TestModel },
|
|
338
|
-
{ type: '&', tag: 'pickles' }
|
|
338
|
+
{ type: '&', tag: 'pickles' },
|
|
339
339
|
);
|
|
340
340
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
341
341
|
});
|
|
@@ -346,7 +346,7 @@ These hats are absolutely fantastic.`;
|
|
|
346
346
|
// Retrieving entity by tags inclusively...
|
|
347
347
|
const resultEntity = await nymph.getEntities(
|
|
348
348
|
{ class: TestModel },
|
|
349
|
-
{ type: '|', tag: ['pickles', 'test', 'barbecue'] }
|
|
349
|
+
{ type: '|', tag: ['pickles', 'test', 'barbecue'] },
|
|
350
350
|
);
|
|
351
351
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
352
352
|
});
|
|
@@ -357,7 +357,7 @@ These hats are absolutely fantastic.`;
|
|
|
357
357
|
// Testing wrong inclusive tags...
|
|
358
358
|
const resultEntity = await nymph.getEntities(
|
|
359
359
|
{ class: TestModel },
|
|
360
|
-
{ type: '|', tag: ['pickles', 'barbecue'] }
|
|
360
|
+
{ type: '|', tag: ['pickles', 'barbecue'] },
|
|
361
361
|
);
|
|
362
362
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
363
363
|
});
|
|
@@ -369,7 +369,7 @@ These hats are absolutely fantastic.`;
|
|
|
369
369
|
const resultEntity = await nymph.getEntities(
|
|
370
370
|
{ class: TestModel },
|
|
371
371
|
{ type: '&', tag: 'test' },
|
|
372
|
-
{ type: '|', tag: ['pickles', 'test', 'barbecue'] }
|
|
372
|
+
{ type: '|', tag: ['pickles', 'test', 'barbecue'] },
|
|
373
373
|
);
|
|
374
374
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
375
375
|
});
|
|
@@ -381,7 +381,7 @@ These hats are absolutely fantastic.`;
|
|
|
381
381
|
const resultEntity = await nymph.getEntities(
|
|
382
382
|
{ class: TestModel },
|
|
383
383
|
{ type: '&', tag: 'test' },
|
|
384
|
-
{ type: '|', tag: ['pickles', 'barbecue'] }
|
|
384
|
+
{ type: '|', tag: ['pickles', 'barbecue'] },
|
|
385
385
|
);
|
|
386
386
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
387
387
|
});
|
|
@@ -393,7 +393,7 @@ These hats are absolutely fantastic.`;
|
|
|
393
393
|
const resultEntity = await nymph.getEntities(
|
|
394
394
|
{ class: TestModel },
|
|
395
395
|
{ type: '&', tag: 'pickles' },
|
|
396
|
-
{ type: '|', tag: ['test', 'barbecue'] }
|
|
396
|
+
{ type: '|', tag: ['test', 'barbecue'] },
|
|
397
397
|
);
|
|
398
398
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
399
399
|
});
|
|
@@ -404,7 +404,7 @@ These hats are absolutely fantastic.`;
|
|
|
404
404
|
// Retrieving entity by defined...
|
|
405
405
|
const resultEntity = await nymph.getEntities(
|
|
406
406
|
{ class: TestModel },
|
|
407
|
-
{ type: '&', defined: 'string' }
|
|
407
|
+
{ type: '&', defined: 'string' },
|
|
408
408
|
);
|
|
409
409
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
410
410
|
});
|
|
@@ -415,7 +415,7 @@ These hats are absolutely fantastic.`;
|
|
|
415
415
|
// Retrieving entity by !defined...
|
|
416
416
|
const resultEntity = await nymph.getEntities(
|
|
417
417
|
{ class: TestModel },
|
|
418
|
-
{ type: '&', tag: 'test', '!defined': 'pickles' }
|
|
418
|
+
{ type: '&', tag: 'test', '!defined': 'pickles' },
|
|
419
419
|
);
|
|
420
420
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
421
421
|
});
|
|
@@ -427,7 +427,7 @@ These hats are absolutely fantastic.`;
|
|
|
427
427
|
const resultEntity = await nymph.getEntities(
|
|
428
428
|
{ class: TestModel },
|
|
429
429
|
{ type: '!&', defined: 'pickles' },
|
|
430
|
-
{ type: '&', tag: 'test' }
|
|
430
|
+
{ type: '&', tag: 'test' },
|
|
431
431
|
);
|
|
432
432
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
433
433
|
});
|
|
@@ -438,7 +438,7 @@ These hats are absolutely fantastic.`;
|
|
|
438
438
|
// Retrieving entity by equal...
|
|
439
439
|
const resultEntity = await nymph.getEntities(
|
|
440
440
|
{ class: TestModel },
|
|
441
|
-
{ type: '&', equal: ['string', 'test'] }
|
|
441
|
+
{ type: '&', equal: ['string', 'test'] },
|
|
442
442
|
);
|
|
443
443
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
444
444
|
});
|
|
@@ -452,7 +452,7 @@ These hats are absolutely fantastic.`;
|
|
|
452
452
|
// Retrieving entity by !equal...
|
|
453
453
|
const resultEntity = await nymph.getEntities(
|
|
454
454
|
{ class: TestModel },
|
|
455
|
-
{ type: '&', tag: 'test', '!equal': ['string', 'wrong'] }
|
|
455
|
+
{ type: '&', tag: 'test', '!equal': ['string', 'wrong'] },
|
|
456
456
|
);
|
|
457
457
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
458
458
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -464,7 +464,7 @@ These hats are absolutely fantastic.`;
|
|
|
464
464
|
// Retrieving entity by like...
|
|
465
465
|
const resultEntity = await nymph.getEntities(
|
|
466
466
|
{ class: TestModel },
|
|
467
|
-
{ type: '&', like: ['string', 't_s%'] }
|
|
467
|
+
{ type: '&', like: ['string', 't_s%'] },
|
|
468
468
|
);
|
|
469
469
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
470
470
|
});
|
|
@@ -478,7 +478,7 @@ These hats are absolutely fantastic.`;
|
|
|
478
478
|
// Retrieving entity by !like...
|
|
479
479
|
const resultEntity = await nymph.getEntities(
|
|
480
480
|
{ class: TestModel },
|
|
481
|
-
{ type: '&', tag: 'test', '!like': ['string', 'wr_n%'] }
|
|
481
|
+
{ type: '&', tag: 'test', '!like': ['string', 'wr_n%'] },
|
|
482
482
|
);
|
|
483
483
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
484
484
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -490,7 +490,7 @@ These hats are absolutely fantastic.`;
|
|
|
490
490
|
// Retrieving entity by ilike...
|
|
491
491
|
const resultEntity = await nymph.getEntities(
|
|
492
492
|
{ class: TestModel },
|
|
493
|
-
{ type: '&', ilike: ['string', 'T_s%'] }
|
|
493
|
+
{ type: '&', ilike: ['string', 'T_s%'] },
|
|
494
494
|
);
|
|
495
495
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
496
496
|
});
|
|
@@ -504,7 +504,7 @@ These hats are absolutely fantastic.`;
|
|
|
504
504
|
// Retrieving entity by !ilike...
|
|
505
505
|
const resultEntity = await nymph.getEntities(
|
|
506
506
|
{ class: TestModel },
|
|
507
|
-
{ type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] }
|
|
507
|
+
{ type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] },
|
|
508
508
|
);
|
|
509
509
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
510
510
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -516,7 +516,7 @@ These hats are absolutely fantastic.`;
|
|
|
516
516
|
// Retrieving entity by like...
|
|
517
517
|
const resultEntity = await nymph.getEntities(
|
|
518
518
|
{ class: TestModel },
|
|
519
|
-
{ type: '&', like: ['string', 'T_s%'] }
|
|
519
|
+
{ type: '&', like: ['string', 'T_s%'] },
|
|
520
520
|
);
|
|
521
521
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
522
522
|
});
|
|
@@ -527,7 +527,7 @@ These hats are absolutely fantastic.`;
|
|
|
527
527
|
// Retrieving entity by tags and equal...
|
|
528
528
|
const resultEntity = await nymph.getEntities(
|
|
529
529
|
{ class: TestModel },
|
|
530
|
-
{ type: '&', tag: 'test', equal: ['string', 'test'] }
|
|
530
|
+
{ type: '&', tag: 'test', equal: ['string', 'test'] },
|
|
531
531
|
);
|
|
532
532
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
533
533
|
});
|
|
@@ -538,7 +538,7 @@ These hats are absolutely fantastic.`;
|
|
|
538
538
|
// Testing wrong tags and right equal...
|
|
539
539
|
const resultEntity = await nymph.getEntities(
|
|
540
540
|
{ class: TestModel },
|
|
541
|
-
{ type: '&', tag: 'pickles', equal: ['string', 'test'] }
|
|
541
|
+
{ type: '&', tag: 'pickles', equal: ['string', 'test'] },
|
|
542
542
|
);
|
|
543
543
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
544
544
|
});
|
|
@@ -549,7 +549,7 @@ These hats are absolutely fantastic.`;
|
|
|
549
549
|
// Testing right tags and wrong equal...
|
|
550
550
|
const resultEntity = await nymph.getEntities(
|
|
551
551
|
{ class: TestModel },
|
|
552
|
-
{ type: '&', tag: 'test', equal: ['string', 'pickles'] }
|
|
552
|
+
{ type: '&', tag: 'test', equal: ['string', 'pickles'] },
|
|
553
553
|
);
|
|
554
554
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
555
555
|
});
|
|
@@ -560,7 +560,7 @@ These hats are absolutely fantastic.`;
|
|
|
560
560
|
// Testing wrong tags and wrong equal...
|
|
561
561
|
const resultEntity = await nymph.getEntities(
|
|
562
562
|
{ class: TestModel },
|
|
563
|
-
{ type: '&', tag: 'pickles', equal: ['string', 'pickles'] }
|
|
563
|
+
{ type: '&', tag: 'pickles', equal: ['string', 'pickles'] },
|
|
564
564
|
);
|
|
565
565
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
566
566
|
});
|
|
@@ -571,14 +571,14 @@ These hats are absolutely fantastic.`;
|
|
|
571
571
|
// Retrieving entity by contain...
|
|
572
572
|
let resultEntity = await nymph.getEntities(
|
|
573
573
|
{ class: TestModel },
|
|
574
|
-
{ type: '&', contain: ['array', 'values'] }
|
|
574
|
+
{ type: '&', contain: ['array', 'values'] },
|
|
575
575
|
);
|
|
576
576
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
577
577
|
|
|
578
578
|
// Retrieving entity by contain with full match...
|
|
579
579
|
resultEntity = await nymph.getEntities(
|
|
580
580
|
{ class: TestModel },
|
|
581
|
-
{ type: '&', contain: ['string', 'test'] }
|
|
581
|
+
{ type: '&', contain: ['string', 'test'] },
|
|
582
582
|
);
|
|
583
583
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
584
584
|
});
|
|
@@ -590,7 +590,7 @@ These hats are absolutely fantastic.`;
|
|
|
590
590
|
const resultEntity = await nymph.getEntities(
|
|
591
591
|
{ class: TestModel },
|
|
592
592
|
{ type: '&', tag: 'test' },
|
|
593
|
-
{ type: '!&', contain: ['array', 'pickles'] }
|
|
593
|
+
{ type: '!&', contain: ['array', 'pickles'] },
|
|
594
594
|
);
|
|
595
595
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
596
596
|
});
|
|
@@ -601,14 +601,14 @@ These hats are absolutely fantastic.`;
|
|
|
601
601
|
// Testing wrong contain...
|
|
602
602
|
let resultEntity = await nymph.getEntities(
|
|
603
603
|
{ class: TestModel },
|
|
604
|
-
{ type: '&', contain: ['array', 'pickles'] }
|
|
604
|
+
{ type: '&', contain: ['array', 'pickles'] },
|
|
605
605
|
);
|
|
606
606
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
607
607
|
|
|
608
608
|
// Testing wrong contain...
|
|
609
609
|
resultEntity = await nymph.getEntities(
|
|
610
610
|
{ class: TestModel },
|
|
611
|
-
{ type: '&', contain: ['string', 'pickles'] }
|
|
611
|
+
{ type: '&', contain: ['string', 'pickles'] },
|
|
612
612
|
);
|
|
613
613
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
614
614
|
});
|
|
@@ -619,12 +619,12 @@ These hats are absolutely fantastic.`;
|
|
|
619
619
|
// Retrieving entity by regex match...
|
|
620
620
|
let resultEntity = await nymph.getEntities(
|
|
621
621
|
{ class: TestModel },
|
|
622
|
-
{ type: '&', match: ['match', '.*'] } // anything
|
|
622
|
+
{ type: '&', match: ['match', '.*'] }, // anything
|
|
623
623
|
);
|
|
624
624
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
625
625
|
resultEntity = await nymph.getEntities(
|
|
626
626
|
{ class: TestModel },
|
|
627
|
-
{ type: '&', tag: 'test', match: ['match', 'Edward McCheese'] } // a substring
|
|
627
|
+
{ type: '&', tag: 'test', match: ['match', 'Edward McCheese'] }, // a substring
|
|
628
628
|
);
|
|
629
629
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
630
630
|
resultEntity = await nymph.getEntities(
|
|
@@ -636,7 +636,7 @@ These hats are absolutely fantastic.`;
|
|
|
636
636
|
['string', '[0-9]'],
|
|
637
637
|
['match', 'Edward McCheese'],
|
|
638
638
|
],
|
|
639
|
-
} // inclusive test
|
|
639
|
+
}, // inclusive test
|
|
640
640
|
);
|
|
641
641
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
642
642
|
resultEntity = await nymph.getEntities(
|
|
@@ -645,7 +645,7 @@ These hats are absolutely fantastic.`;
|
|
|
645
645
|
type: '&',
|
|
646
646
|
tag: 'test',
|
|
647
647
|
match: ['match', '[-a-zA-Z0-9+_]+@[-a-zA-Z0-9_]+.[-a-zA-Z0-9_]{2,4}'],
|
|
648
|
-
} // a simple email
|
|
648
|
+
}, // a simple email
|
|
649
649
|
);
|
|
650
650
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
651
651
|
resultEntity = await nymph.getEntities(
|
|
@@ -654,7 +654,7 @@ These hats are absolutely fantastic.`;
|
|
|
654
654
|
type: '&',
|
|
655
655
|
tag: 'test',
|
|
656
656
|
match: ['match', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'],
|
|
657
|
-
} // a phone number
|
|
657
|
+
}, // a phone number
|
|
658
658
|
);
|
|
659
659
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
660
660
|
});
|
|
@@ -665,7 +665,7 @@ These hats are absolutely fantastic.`;
|
|
|
665
665
|
// Retrieving entity by regex match...
|
|
666
666
|
const resultEntity = await nymph.getEntities(
|
|
667
667
|
{ class: TestModel },
|
|
668
|
-
{ type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] } // a substring
|
|
668
|
+
{ type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] }, // a substring
|
|
669
669
|
);
|
|
670
670
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
671
671
|
});
|
|
@@ -676,12 +676,12 @@ These hats are absolutely fantastic.`;
|
|
|
676
676
|
// Testing wrong regex match...
|
|
677
677
|
let resultEntity = await nymph.getEntities(
|
|
678
678
|
{ class: TestModel },
|
|
679
|
-
{ type: '&', match: ['match', 'Q'] }
|
|
679
|
+
{ type: '&', match: ['match', 'Q'] },
|
|
680
680
|
);
|
|
681
681
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
682
682
|
resultEntity = await nymph.getEntities(
|
|
683
683
|
{ class: TestModel },
|
|
684
|
-
{ type: '&', tag: 'pickle', match: ['match', '.*'] }
|
|
684
|
+
{ type: '&', tag: 'pickle', match: ['match', '.*'] },
|
|
685
685
|
);
|
|
686
686
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
687
687
|
resultEntity = await nymph.getEntities(
|
|
@@ -692,7 +692,7 @@ These hats are absolutely fantastic.`;
|
|
|
692
692
|
['string', '[0-9]'],
|
|
693
693
|
['match', ',,'],
|
|
694
694
|
],
|
|
695
|
-
}
|
|
695
|
+
},
|
|
696
696
|
);
|
|
697
697
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
698
698
|
});
|
|
@@ -703,7 +703,7 @@ These hats are absolutely fantastic.`;
|
|
|
703
703
|
// Retrieving entity by regex match...
|
|
704
704
|
const resultEntity = await nymph.getEntities(
|
|
705
705
|
{ class: TestModel },
|
|
706
|
-
{ type: '&', tag: 'test', match: ['match', 'edward mccheese'] } // a substring
|
|
706
|
+
{ type: '&', tag: 'test', match: ['match', 'edward mccheese'] }, // a substring
|
|
707
707
|
);
|
|
708
708
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
709
709
|
});
|
|
@@ -715,7 +715,7 @@ These hats are absolutely fantastic.`;
|
|
|
715
715
|
const resultEntity = await nymph.getEntities(
|
|
716
716
|
{ class: TestModel },
|
|
717
717
|
{ type: '&', tag: 'test' },
|
|
718
|
-
{ type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] }
|
|
718
|
+
{ type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] },
|
|
719
719
|
);
|
|
720
720
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
721
721
|
});
|
|
@@ -732,7 +732,7 @@ These hats are absolutely fantastic.`;
|
|
|
732
732
|
['number', 30],
|
|
733
733
|
['pickles', 100],
|
|
734
734
|
],
|
|
735
|
-
}
|
|
735
|
+
},
|
|
736
736
|
);
|
|
737
737
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
738
738
|
|
|
@@ -745,7 +745,7 @@ These hats are absolutely fantastic.`;
|
|
|
745
745
|
['number', 31],
|
|
746
746
|
['pickles', 100],
|
|
747
747
|
],
|
|
748
|
-
}
|
|
748
|
+
},
|
|
749
749
|
);
|
|
750
750
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
751
751
|
|
|
@@ -758,7 +758,7 @@ These hats are absolutely fantastic.`;
|
|
|
758
758
|
['number', 29],
|
|
759
759
|
['pickles', 100],
|
|
760
760
|
],
|
|
761
|
-
}
|
|
761
|
+
},
|
|
762
762
|
);
|
|
763
763
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
764
764
|
|
|
@@ -771,7 +771,7 @@ These hats are absolutely fantastic.`;
|
|
|
771
771
|
['numberString', 30],
|
|
772
772
|
['pickles', 100],
|
|
773
773
|
],
|
|
774
|
-
}
|
|
774
|
+
},
|
|
775
775
|
);
|
|
776
776
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
777
777
|
|
|
@@ -784,7 +784,7 @@ These hats are absolutely fantastic.`;
|
|
|
784
784
|
['numberString', 31],
|
|
785
785
|
['pickles', 100],
|
|
786
786
|
],
|
|
787
|
-
}
|
|
787
|
+
},
|
|
788
788
|
);
|
|
789
789
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
790
790
|
|
|
@@ -797,7 +797,7 @@ These hats are absolutely fantastic.`;
|
|
|
797
797
|
['numberString', 29],
|
|
798
798
|
['pickles', 100],
|
|
799
799
|
],
|
|
800
|
-
}
|
|
800
|
+
},
|
|
801
801
|
);
|
|
802
802
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
803
803
|
});
|
|
@@ -814,7 +814,7 @@ These hats are absolutely fantastic.`;
|
|
|
814
814
|
['number', 30],
|
|
815
815
|
['pickles', 100],
|
|
816
816
|
],
|
|
817
|
-
}
|
|
817
|
+
},
|
|
818
818
|
);
|
|
819
819
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
820
820
|
|
|
@@ -827,7 +827,7 @@ These hats are absolutely fantastic.`;
|
|
|
827
827
|
['number', 31],
|
|
828
828
|
['pickles', 100],
|
|
829
829
|
],
|
|
830
|
-
}
|
|
830
|
+
},
|
|
831
831
|
);
|
|
832
832
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
833
833
|
|
|
@@ -840,7 +840,7 @@ These hats are absolutely fantastic.`;
|
|
|
840
840
|
['number', 29],
|
|
841
841
|
['pickles', 100],
|
|
842
842
|
],
|
|
843
|
-
}
|
|
843
|
+
},
|
|
844
844
|
);
|
|
845
845
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
846
846
|
|
|
@@ -853,7 +853,7 @@ These hats are absolutely fantastic.`;
|
|
|
853
853
|
['numberString', 30],
|
|
854
854
|
['pickles', 100],
|
|
855
855
|
],
|
|
856
|
-
}
|
|
856
|
+
},
|
|
857
857
|
);
|
|
858
858
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
859
859
|
|
|
@@ -866,7 +866,7 @@ These hats are absolutely fantastic.`;
|
|
|
866
866
|
['numberString', 31],
|
|
867
867
|
['pickles', 100],
|
|
868
868
|
],
|
|
869
|
-
}
|
|
869
|
+
},
|
|
870
870
|
);
|
|
871
871
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
872
872
|
|
|
@@ -879,7 +879,7 @@ These hats are absolutely fantastic.`;
|
|
|
879
879
|
['numberString', 29],
|
|
880
880
|
['pickles', 100],
|
|
881
881
|
],
|
|
882
|
-
}
|
|
882
|
+
},
|
|
883
883
|
);
|
|
884
884
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
885
885
|
});
|
|
@@ -896,7 +896,7 @@ These hats are absolutely fantastic.`;
|
|
|
896
896
|
['number', 30],
|
|
897
897
|
['pickles', 100],
|
|
898
898
|
],
|
|
899
|
-
}
|
|
899
|
+
},
|
|
900
900
|
);
|
|
901
901
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
902
902
|
|
|
@@ -909,7 +909,7 @@ These hats are absolutely fantastic.`;
|
|
|
909
909
|
['number', 31],
|
|
910
910
|
['pickles', 100],
|
|
911
911
|
],
|
|
912
|
-
}
|
|
912
|
+
},
|
|
913
913
|
);
|
|
914
914
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
915
915
|
|
|
@@ -922,7 +922,7 @@ These hats are absolutely fantastic.`;
|
|
|
922
922
|
['number', 29],
|
|
923
923
|
['pickles', 100],
|
|
924
924
|
],
|
|
925
|
-
}
|
|
925
|
+
},
|
|
926
926
|
);
|
|
927
927
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
928
928
|
|
|
@@ -935,7 +935,7 @@ These hats are absolutely fantastic.`;
|
|
|
935
935
|
['numberString', 30],
|
|
936
936
|
['pickles', 100],
|
|
937
937
|
],
|
|
938
|
-
}
|
|
938
|
+
},
|
|
939
939
|
);
|
|
940
940
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
941
941
|
|
|
@@ -948,7 +948,7 @@ These hats are absolutely fantastic.`;
|
|
|
948
948
|
['numberString', 31],
|
|
949
949
|
['pickles', 100],
|
|
950
950
|
],
|
|
951
|
-
}
|
|
951
|
+
},
|
|
952
952
|
);
|
|
953
953
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
954
954
|
|
|
@@ -961,7 +961,7 @@ These hats are absolutely fantastic.`;
|
|
|
961
961
|
['numberString', 29],
|
|
962
962
|
['pickles', 100],
|
|
963
963
|
],
|
|
964
|
-
}
|
|
964
|
+
},
|
|
965
965
|
);
|
|
966
966
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
967
967
|
});
|
|
@@ -978,7 +978,7 @@ These hats are absolutely fantastic.`;
|
|
|
978
978
|
['number', 30],
|
|
979
979
|
['pickles', 100],
|
|
980
980
|
],
|
|
981
|
-
}
|
|
981
|
+
},
|
|
982
982
|
);
|
|
983
983
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
984
984
|
|
|
@@ -991,7 +991,7 @@ These hats are absolutely fantastic.`;
|
|
|
991
991
|
['number', 31],
|
|
992
992
|
['pickles', 100],
|
|
993
993
|
],
|
|
994
|
-
}
|
|
994
|
+
},
|
|
995
995
|
);
|
|
996
996
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
997
997
|
|
|
@@ -1004,7 +1004,7 @@ These hats are absolutely fantastic.`;
|
|
|
1004
1004
|
['number', 29],
|
|
1005
1005
|
['pickles', 100],
|
|
1006
1006
|
],
|
|
1007
|
-
}
|
|
1007
|
+
},
|
|
1008
1008
|
);
|
|
1009
1009
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1010
1010
|
|
|
@@ -1017,7 +1017,7 @@ These hats are absolutely fantastic.`;
|
|
|
1017
1017
|
['numberString', 30],
|
|
1018
1018
|
['pickles', 100],
|
|
1019
1019
|
],
|
|
1020
|
-
}
|
|
1020
|
+
},
|
|
1021
1021
|
);
|
|
1022
1022
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1023
1023
|
|
|
@@ -1030,7 +1030,7 @@ These hats are absolutely fantastic.`;
|
|
|
1030
1030
|
['numberString', 31],
|
|
1031
1031
|
['pickles', 100],
|
|
1032
1032
|
],
|
|
1033
|
-
}
|
|
1033
|
+
},
|
|
1034
1034
|
);
|
|
1035
1035
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1036
1036
|
|
|
@@ -1043,7 +1043,7 @@ These hats are absolutely fantastic.`;
|
|
|
1043
1043
|
['numberString', 29],
|
|
1044
1044
|
['pickles', 100],
|
|
1045
1045
|
],
|
|
1046
|
-
}
|
|
1046
|
+
},
|
|
1047
1047
|
);
|
|
1048
1048
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1049
1049
|
});
|
|
@@ -1055,7 +1055,7 @@ These hats are absolutely fantastic.`;
|
|
|
1055
1055
|
const resultEntity = await nymph.getEntities(
|
|
1056
1056
|
{ class: TestModel },
|
|
1057
1057
|
{ type: '&', tag: 'test' },
|
|
1058
|
-
{ type: '!&', gte: ['number', 60] }
|
|
1058
|
+
{ type: '!&', gte: ['number', 60] },
|
|
1059
1059
|
);
|
|
1060
1060
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1061
1061
|
});
|
|
@@ -1066,7 +1066,7 @@ These hats are absolutely fantastic.`;
|
|
|
1066
1066
|
// Testing wrong inequality...
|
|
1067
1067
|
const resultEntity = await nymph.getEntities(
|
|
1068
1068
|
{ class: TestModel },
|
|
1069
|
-
{ type: '&', lte: ['number', 29.99] }
|
|
1069
|
+
{ type: '&', lte: ['number', 29.99] },
|
|
1070
1070
|
);
|
|
1071
1071
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1072
1072
|
});
|
|
@@ -1077,7 +1077,7 @@ These hats are absolutely fantastic.`;
|
|
|
1077
1077
|
// Retrieving entity by time...
|
|
1078
1078
|
const resultEntity = await nymph.getEntities(
|
|
1079
1079
|
{ class: TestModel },
|
|
1080
|
-
{ type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] }
|
|
1080
|
+
{ type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] },
|
|
1081
1081
|
);
|
|
1082
1082
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1083
1083
|
});
|
|
@@ -1088,7 +1088,7 @@ These hats are absolutely fantastic.`;
|
|
|
1088
1088
|
// Testing wrong time...
|
|
1089
1089
|
const resultEntity = await nymph.getEntities(
|
|
1090
1090
|
{ class: TestModel },
|
|
1091
|
-
{ type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] }
|
|
1091
|
+
{ type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] },
|
|
1092
1092
|
);
|
|
1093
1093
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1094
1094
|
});
|
|
@@ -1101,7 +1101,7 @@ These hats are absolutely fantastic.`;
|
|
|
1101
1101
|
// Retrieving entity by relative time...
|
|
1102
1102
|
let resultEntity = await nymph.getEntities(
|
|
1103
1103
|
{ class: TestModel },
|
|
1104
|
-
{ type: '&', gt: ['timestamp', null, '-1 day'] }
|
|
1104
|
+
{ type: '&', gt: ['timestamp', null, '-1 day'] },
|
|
1105
1105
|
);
|
|
1106
1106
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1107
1107
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -1115,7 +1115,7 @@ These hats are absolutely fantastic.`;
|
|
|
1115
1115
|
['timestamp', null, '-1 day'],
|
|
1116
1116
|
['timestamp', null, '+5 days'],
|
|
1117
1117
|
],
|
|
1118
|
-
}
|
|
1118
|
+
},
|
|
1119
1119
|
);
|
|
1120
1120
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1121
1121
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -1123,7 +1123,7 @@ These hats are absolutely fantastic.`;
|
|
|
1123
1123
|
// Retrieving entity by relative time...
|
|
1124
1124
|
resultEntity = await nymph.getEntities(
|
|
1125
1125
|
{ class: TestModel },
|
|
1126
|
-
{ type: '&', gt: ['timestamp', null, '-3 days'] }
|
|
1126
|
+
{ type: '&', gt: ['timestamp', null, '-3 days'] },
|
|
1127
1127
|
);
|
|
1128
1128
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1129
1129
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
@@ -1131,7 +1131,7 @@ These hats are absolutely fantastic.`;
|
|
|
1131
1131
|
// Retrieving entity by relative time...
|
|
1132
1132
|
resultEntity = await nymph.getEntities(
|
|
1133
1133
|
{ class: TestModel },
|
|
1134
|
-
{ type: '&', gt: ['cdate', null, '-1 day'] }
|
|
1134
|
+
{ type: '&', gt: ['cdate', null, '-1 day'] },
|
|
1135
1135
|
);
|
|
1136
1136
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1137
1137
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
@@ -1145,7 +1145,7 @@ These hats are absolutely fantastic.`;
|
|
|
1145
1145
|
// Retrieving entity by relative time...
|
|
1146
1146
|
let resultEntity = await nymph.getEntities(
|
|
1147
1147
|
{ class: TestModel },
|
|
1148
|
-
{ type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] }
|
|
1148
|
+
{ type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] },
|
|
1149
1149
|
);
|
|
1150
1150
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1151
1151
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -1153,7 +1153,7 @@ These hats are absolutely fantastic.`;
|
|
|
1153
1153
|
// Retrieving entity by relative time...
|
|
1154
1154
|
resultEntity = await nymph.getEntities(
|
|
1155
1155
|
{ class: TestModel },
|
|
1156
|
-
{ type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] }
|
|
1156
|
+
{ type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] },
|
|
1157
1157
|
);
|
|
1158
1158
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1159
1159
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -1161,7 +1161,7 @@ These hats are absolutely fantastic.`;
|
|
|
1161
1161
|
// Retrieving entity by relative time...
|
|
1162
1162
|
resultEntity = await nymph.getEntities(
|
|
1163
1163
|
{ class: TestModel },
|
|
1164
|
-
{ type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] }
|
|
1164
|
+
{ type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] },
|
|
1165
1165
|
);
|
|
1166
1166
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1167
1167
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
@@ -1185,7 +1185,7 @@ These hats are absolutely fantastic.`;
|
|
|
1185
1185
|
// Retrieving entity by reference...
|
|
1186
1186
|
const resultEntity = await nymph.getEntities(
|
|
1187
1187
|
{ class: TestModel },
|
|
1188
|
-
{ type: '&', ref: ['reference', refGuid] }
|
|
1188
|
+
{ type: '&', ref: ['reference', refGuid] },
|
|
1189
1189
|
);
|
|
1190
1190
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1191
1191
|
});
|
|
@@ -1197,7 +1197,7 @@ These hats are absolutely fantastic.`;
|
|
|
1197
1197
|
const resultEntity = await nymph.getEntities(
|
|
1198
1198
|
{ class: TestModel },
|
|
1199
1199
|
{ type: '&', tag: 'test' },
|
|
1200
|
-
{ type: '!&', ref: ['reference', guid()] }
|
|
1200
|
+
{ type: '!&', ref: ['reference', guid()] },
|
|
1201
1201
|
);
|
|
1202
1202
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1203
1203
|
});
|
|
@@ -1208,7 +1208,7 @@ These hats are absolutely fantastic.`;
|
|
|
1208
1208
|
// Testing wrong reference...
|
|
1209
1209
|
const resultEntity = await nymph.getEntities(
|
|
1210
1210
|
{ class: TestModel },
|
|
1211
|
-
{ type: '&', ref: ['reference', guid()] }
|
|
1211
|
+
{ type: '&', ref: ['reference', guid()] },
|
|
1212
1212
|
);
|
|
1213
1213
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1214
1214
|
});
|
|
@@ -1219,7 +1219,7 @@ These hats are absolutely fantastic.`;
|
|
|
1219
1219
|
// Testing non-existent reference...
|
|
1220
1220
|
const resultEntity = await nymph.getEntities(
|
|
1221
1221
|
{ class: TestModel },
|
|
1222
|
-
{ type: '&', ref: ['pickle', refGuid] }
|
|
1222
|
+
{ type: '&', ref: ['pickle', refGuid] },
|
|
1223
1223
|
);
|
|
1224
1224
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1225
1225
|
});
|
|
@@ -1236,7 +1236,7 @@ These hats are absolutely fantastic.`;
|
|
|
1236
1236
|
['reference', refGuid],
|
|
1237
1237
|
['reference', guid()],
|
|
1238
1238
|
],
|
|
1239
|
-
}
|
|
1239
|
+
},
|
|
1240
1240
|
);
|
|
1241
1241
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1242
1242
|
});
|
|
@@ -1253,7 +1253,7 @@ These hats are absolutely fantastic.`;
|
|
|
1253
1253
|
['reference', guid()],
|
|
1254
1254
|
['reference', guid()],
|
|
1255
1255
|
],
|
|
1256
|
-
}
|
|
1256
|
+
},
|
|
1257
1257
|
);
|
|
1258
1258
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1259
1259
|
});
|
|
@@ -1264,7 +1264,7 @@ These hats are absolutely fantastic.`;
|
|
|
1264
1264
|
// Retrieving entity by array reference...
|
|
1265
1265
|
const resultEntity = await nymph.getEntities(
|
|
1266
1266
|
{ class: TestModel },
|
|
1267
|
-
{ type: '&', ref: ['refArray', refGuid] }
|
|
1267
|
+
{ type: '&', ref: ['refArray', refGuid] },
|
|
1268
1268
|
);
|
|
1269
1269
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1270
1270
|
});
|
|
@@ -1281,7 +1281,7 @@ These hats are absolutely fantastic.`;
|
|
|
1281
1281
|
['refArray', refGuid],
|
|
1282
1282
|
['refArray', guid()],
|
|
1283
1283
|
],
|
|
1284
|
-
}
|
|
1284
|
+
},
|
|
1285
1285
|
);
|
|
1286
1286
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1287
1287
|
});
|
|
@@ -1326,7 +1326,7 @@ These hats are absolutely fantastic.`;
|
|
|
1326
1326
|
['array', 'values'],
|
|
1327
1327
|
['array', 500],
|
|
1328
1328
|
],
|
|
1329
|
-
}
|
|
1329
|
+
},
|
|
1330
1330
|
);
|
|
1331
1331
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1332
1332
|
});
|
|
@@ -1346,13 +1346,13 @@ These hats are absolutely fantastic.`;
|
|
|
1346
1346
|
|
|
1347
1347
|
const resultSelectors = await nymph.getEntities(
|
|
1348
1348
|
{ class: TestModel },
|
|
1349
|
-
{ type: '&', ref: ['reference', refGuid] }
|
|
1349
|
+
{ type: '&', ref: ['reference', refGuid] },
|
|
1350
1350
|
);
|
|
1351
1351
|
|
|
1352
1352
|
// Testing count return with selectors...
|
|
1353
1353
|
const resultSelectorsCount = await nymph.getEntities(
|
|
1354
1354
|
{ class: TestModel, return: 'count' },
|
|
1355
|
-
{ type: '&', ref: ['reference', refGuid] }
|
|
1355
|
+
{ type: '&', ref: ['reference', refGuid] },
|
|
1356
1356
|
);
|
|
1357
1357
|
expect(resultSelectorsCount).toBeGreaterThanOrEqual(1);
|
|
1358
1358
|
expect(resultSelectorsCount).toEqual(resultSelectors.length);
|
|
@@ -1375,7 +1375,7 @@ These hats are absolutely fantastic.`;
|
|
|
1375
1375
|
// Testing empty count...
|
|
1376
1376
|
const resultSelectorsEmpty = await nymph.getEntities(
|
|
1377
1377
|
{ class: TestModel, return: 'count' },
|
|
1378
|
-
{ type: '&', ref: ['reference', guid()] }
|
|
1378
|
+
{ type: '&', ref: ['reference', guid()] },
|
|
1379
1379
|
);
|
|
1380
1380
|
expect(resultSelectorsEmpty).toEqual(0);
|
|
1381
1381
|
});
|
|
@@ -1420,7 +1420,7 @@ These hats are absolutely fantastic.`;
|
|
|
1420
1420
|
['array', 'values'],
|
|
1421
1421
|
['array', 500],
|
|
1422
1422
|
],
|
|
1423
|
-
}
|
|
1423
|
+
},
|
|
1424
1424
|
);
|
|
1425
1425
|
expect(resultGuid.indexOf(testEntity.guid ?? '')).toBeGreaterThan(-1);
|
|
1426
1426
|
});
|
|
@@ -1470,7 +1470,7 @@ These hats are absolutely fantastic.`;
|
|
|
1470
1470
|
],
|
|
1471
1471
|
},
|
|
1472
1472
|
],
|
|
1473
|
-
}
|
|
1473
|
+
},
|
|
1474
1474
|
);
|
|
1475
1475
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1476
1476
|
|
|
@@ -1515,7 +1515,7 @@ These hats are absolutely fantastic.`;
|
|
|
1515
1515
|
],
|
|
1516
1516
|
},
|
|
1517
1517
|
],
|
|
1518
|
-
}
|
|
1518
|
+
},
|
|
1519
1519
|
);
|
|
1520
1520
|
expect(testEntity.$inArray(resultEntity2)).toEqual(true);
|
|
1521
1521
|
|
|
@@ -1531,7 +1531,7 @@ These hats are absolutely fantastic.`;
|
|
|
1531
1531
|
},
|
|
1532
1532
|
{ type: '&', gte: ['number', 16000] },
|
|
1533
1533
|
],
|
|
1534
|
-
}
|
|
1534
|
+
},
|
|
1535
1535
|
);
|
|
1536
1536
|
expect(testEntity.$inArray(resultEntity3)).toEqual(true);
|
|
1537
1537
|
|
|
@@ -1553,7 +1553,7 @@ These hats are absolutely fantastic.`;
|
|
|
1553
1553
|
},
|
|
1554
1554
|
},
|
|
1555
1555
|
],
|
|
1556
|
-
}
|
|
1556
|
+
},
|
|
1557
1557
|
);
|
|
1558
1558
|
expect(testEntity.$inArray(resultEntity4)).toEqual(true);
|
|
1559
1559
|
});
|
|
@@ -1572,7 +1572,7 @@ These hats are absolutely fantastic.`;
|
|
|
1572
1572
|
},
|
|
1573
1573
|
{ type: '&', gte: ['number', 16000] },
|
|
1574
1574
|
],
|
|
1575
|
-
}
|
|
1575
|
+
},
|
|
1576
1576
|
);
|
|
1577
1577
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1578
1578
|
});
|
|
@@ -1589,7 +1589,7 @@ These hats are absolutely fantastic.`;
|
|
|
1589
1589
|
'reference',
|
|
1590
1590
|
[{ class: TestModel }, { type: '&', equal: ['test', 'good'] }],
|
|
1591
1591
|
],
|
|
1592
|
-
}
|
|
1592
|
+
},
|
|
1593
1593
|
);
|
|
1594
1594
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1595
1595
|
});
|
|
@@ -1606,7 +1606,7 @@ These hats are absolutely fantastic.`;
|
|
|
1606
1606
|
'reference',
|
|
1607
1607
|
[{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
|
|
1608
1608
|
],
|
|
1609
|
-
}
|
|
1609
|
+
},
|
|
1610
1610
|
);
|
|
1611
1611
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
1612
1612
|
});
|
|
@@ -1623,7 +1623,7 @@ These hats are absolutely fantastic.`;
|
|
|
1623
1623
|
'reference',
|
|
1624
1624
|
[{ class: TestBModel }, { type: '&', equal: ['test', 'good'] }],
|
|
1625
1625
|
],
|
|
1626
|
-
}
|
|
1626
|
+
},
|
|
1627
1627
|
);
|
|
1628
1628
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1629
1629
|
});
|
|
@@ -1640,7 +1640,7 @@ These hats are absolutely fantastic.`;
|
|
|
1640
1640
|
'reference',
|
|
1641
1641
|
[{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
|
|
1642
1642
|
],
|
|
1643
|
-
}
|
|
1643
|
+
},
|
|
1644
1644
|
);
|
|
1645
1645
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
1646
1646
|
});
|
|
@@ -1654,7 +1654,7 @@ These hats are absolutely fantastic.`;
|
|
|
1654
1654
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
1655
1655
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1656
1656
|
expect(resultEntities[i + 1][sort]).toBeGreaterThan(
|
|
1657
|
-
resultEntities[i][sort] ?? 0
|
|
1657
|
+
resultEntities[i][sort] ?? 0,
|
|
1658
1658
|
);
|
|
1659
1659
|
}
|
|
1660
1660
|
|
|
@@ -1678,7 +1678,7 @@ These hats are absolutely fantastic.`;
|
|
|
1678
1678
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
1679
1679
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1680
1680
|
expect(resultEntities[i + 1][sort]).toBeLessThan(
|
|
1681
|
-
resultEntities[i][sort] ?? 0
|
|
1681
|
+
resultEntities[i][sort] ?? 0,
|
|
1682
1682
|
);
|
|
1683
1683
|
}
|
|
1684
1684
|
|
|
@@ -1686,24 +1686,24 @@ These hats are absolutely fantastic.`;
|
|
|
1686
1686
|
// Retrieving entities sorted...
|
|
1687
1687
|
resultEntities = await nymph.getEntities(
|
|
1688
1688
|
{ class: TestModel, sort },
|
|
1689
|
-
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1689
|
+
{ type: '&', match: ['name', '^Multi Test '] },
|
|
1690
1690
|
);
|
|
1691
1691
|
expect(resultEntities.length).toEqual(100);
|
|
1692
1692
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1693
1693
|
expect(resultEntities[i + 1][sort]).toBeGreaterThan(
|
|
1694
|
-
resultEntities[i][sort] ?? 0
|
|
1694
|
+
resultEntities[i][sort] ?? 0,
|
|
1695
1695
|
);
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
1698
|
// Retrieving entities reverse sorted...
|
|
1699
1699
|
resultEntities = await nymph.getEntities(
|
|
1700
1700
|
{ class: TestModel, sort, reverse: true },
|
|
1701
|
-
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1701
|
+
{ type: '&', match: ['name', '^Multi Test '] },
|
|
1702
1702
|
);
|
|
1703
1703
|
expect(resultEntities.length).toEqual(100);
|
|
1704
1704
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1705
1705
|
expect(resultEntities[i + 1][sort]).toBeLessThan(
|
|
1706
|
-
resultEntities[i][sort] ?? 0
|
|
1706
|
+
resultEntities[i][sort] ?? 0,
|
|
1707
1707
|
);
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
@@ -1720,7 +1720,7 @@ These hats are absolutely fantastic.`;
|
|
|
1720
1720
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
1721
1721
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1722
1722
|
expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThanOrEqual(
|
|
1723
|
-
resultEntities[i].number ?? 0
|
|
1723
|
+
resultEntities[i].number ?? 0,
|
|
1724
1724
|
);
|
|
1725
1725
|
}
|
|
1726
1726
|
|
|
@@ -1744,7 +1744,7 @@ These hats are absolutely fantastic.`;
|
|
|
1744
1744
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
1745
1745
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1746
1746
|
expect(resultEntities[i + 1].number ?? 0).toBeLessThanOrEqual(
|
|
1747
|
-
resultEntities[i].number ?? Infinity
|
|
1747
|
+
resultEntities[i].number ?? Infinity,
|
|
1748
1748
|
);
|
|
1749
1749
|
}
|
|
1750
1750
|
|
|
@@ -1752,30 +1752,30 @@ These hats are absolutely fantastic.`;
|
|
|
1752
1752
|
// Retrieving entities sorted...
|
|
1753
1753
|
resultEntities = await nymph.getEntities(
|
|
1754
1754
|
{ class: TestModel, sort: 'number' },
|
|
1755
|
-
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1755
|
+
{ type: '&', match: ['name', '^Multi Test '] },
|
|
1756
1756
|
);
|
|
1757
1757
|
expect(resultEntities.length).toEqual(100);
|
|
1758
1758
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1759
1759
|
expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThan(
|
|
1760
|
-
resultEntities[i].number ?? 0
|
|
1760
|
+
resultEntities[i].number ?? 0,
|
|
1761
1761
|
);
|
|
1762
1762
|
expect(resultEntities[i].name).toEqual(
|
|
1763
|
-
`Multi Test ${100 - (resultEntities[i].number ?? 0)}
|
|
1763
|
+
`Multi Test ${100 - (resultEntities[i].number ?? 0)}`,
|
|
1764
1764
|
);
|
|
1765
1765
|
}
|
|
1766
1766
|
|
|
1767
1767
|
// Retrieving entities reverse sorted...
|
|
1768
1768
|
resultEntities = await nymph.getEntities(
|
|
1769
1769
|
{ class: TestModel, sort: 'number', reverse: true },
|
|
1770
|
-
{ type: '&', match: ['name', '^Multi Test '] }
|
|
1770
|
+
{ type: '&', match: ['name', '^Multi Test '] },
|
|
1771
1771
|
);
|
|
1772
1772
|
expect(resultEntities.length).toEqual(100);
|
|
1773
1773
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1774
1774
|
expect(resultEntities[i + 1].number ?? 0).toBeLessThan(
|
|
1775
|
-
resultEntities[i].number ?? Infinity
|
|
1775
|
+
resultEntities[i].number ?? Infinity,
|
|
1776
1776
|
);
|
|
1777
1777
|
expect(resultEntities[i].name).toEqual(
|
|
1778
|
-
`Multi Test ${100 - (resultEntities[i].number ?? 0)}
|
|
1778
|
+
`Multi Test ${100 - (resultEntities[i].number ?? 0)}`,
|
|
1779
1779
|
);
|
|
1780
1780
|
}
|
|
1781
1781
|
});
|
|
@@ -1799,7 +1799,7 @@ These hats are absolutely fantastic.`;
|
|
|
1799
1799
|
|
|
1800
1800
|
const entity = await nymph.getEntity(
|
|
1801
1801
|
{ class: TestModel },
|
|
1802
|
-
{ type: '&', guid: testGuid }
|
|
1802
|
+
{ type: '&', guid: testGuid },
|
|
1803
1803
|
);
|
|
1804
1804
|
|
|
1805
1805
|
expect(entity).toBeNull();
|
|
@@ -1808,7 +1808,7 @@ These hats are absolutely fantastic.`;
|
|
|
1808
1808
|
|
|
1809
1809
|
export function UIDTest(
|
|
1810
1810
|
nymph: Nymph,
|
|
1811
|
-
it: (name: string, fn: () => void) => void
|
|
1811
|
+
it: (name: string, fn: () => void) => void,
|
|
1812
1812
|
) {
|
|
1813
1813
|
it('delete old test data', async () => {
|
|
1814
1814
|
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
@@ -1849,7 +1849,7 @@ export function UIDTest(
|
|
|
1849
1849
|
|
|
1850
1850
|
export function ExportImportTest(
|
|
1851
1851
|
nymph: Nymph,
|
|
1852
|
-
it: (name: string, fn: () => void) => void
|
|
1852
|
+
it: (name: string, fn: () => void) => void,
|
|
1853
1853
|
) {
|
|
1854
1854
|
const TestModel = nymph.addEntityClass(TestModelClass);
|
|
1855
1855
|
const TestBModel = nymph.addEntityClass(TestBModelClass);
|
|
@@ -1947,7 +1947,7 @@ export function ExportImportTest(
|
|
|
1947
1947
|
|
|
1948
1948
|
it('export data', async () => {
|
|
1949
1949
|
expect(await nymph.export(__dirname + '/testentityexport.nex')).toEqual(
|
|
1950
|
-
true
|
|
1950
|
+
true,
|
|
1951
1951
|
);
|
|
1952
1952
|
});
|
|
1953
1953
|
|
|
@@ -1964,7 +1964,7 @@ export function ExportImportTest(
|
|
|
1964
1964
|
expect(bmodels.length).toEqual(0);
|
|
1965
1965
|
|
|
1966
1966
|
expect(await nymph.import(__dirname + '/testentityexport.nex')).toEqual(
|
|
1967
|
-
true
|
|
1967
|
+
true,
|
|
1968
1968
|
);
|
|
1969
1969
|
|
|
1970
1970
|
await checkEntityDataAndCount();
|