@nymphjs/nymph 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +7 -0
- package/README.md +2 -4
- package/dist/Entity.d.ts +1 -1
- package/dist/Entity.js +4 -9
- 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 +2 -2
- package/dist/Nymph.d.ts +2 -5
- package/dist/Nymph.js +22 -23
- package/dist/Nymph.js.map +1 -1
- package/dist/Nymph.types.d.ts +2 -1
- package/dist/driver/NymphDriver.d.ts +1 -1
- package/dist/driver/index.d.ts +0 -2
- package/dist/driver/index.js +1 -3
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/testArtifacts.d.ts +4 -3
- package/dist/driver/testArtifacts.js +158 -153
- package/dist/driver/testArtifacts.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/testArtifacts.js +0 -3
- package/dist/testArtifacts.js.map +1 -1
- package/dist/testMocks.d.ts +14 -11
- package/dist/testMocks.js +20 -10
- package/dist/testMocks.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +9 -7
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/Entity.test.ts +7 -4
- package/src/Entity.ts +6 -7
- package/src/Entity.types.ts +2 -2
- package/src/Nymph.ts +37 -35
- package/src/Nymph.types.ts +2 -1
- package/src/driver/NymphDriver.ts +1 -1
- package/src/driver/index.ts +0 -3
- package/src/driver/testArtifacts.ts +22 -4
- package/src/index.ts +2 -2
- package/src/testArtifacts.ts +0 -5
- package/src/testMocks.ts +33 -28
- package/src/utils.ts +6 -9
- package/dist/driver/PreInitializedDriver.d.ts +0 -30
- package/dist/driver/PreInitializedDriver.js +0 -65
- package/dist/driver/PreInitializedDriver.js.map +0 -1
- package/src/driver/PreInitializedDriver.ts +0 -88
|
@@ -16,9 +16,10 @@ exports.ExportImportTest = exports.UIDTest = exports.QueriesTest = void 0;
|
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const strtotime_1 = __importDefault(require("locutus/php/datetime/strtotime"));
|
|
18
18
|
const newGUID_1 = __importDefault(require("../newGUID"));
|
|
19
|
-
const Nymph_1 = __importDefault(require("../Nymph"));
|
|
20
19
|
const testArtifacts_1 = require("../testArtifacts");
|
|
21
|
-
function QueriesTest(it) {
|
|
20
|
+
function QueriesTest(nymph, it) {
|
|
21
|
+
nymph.setEntityClass(testArtifacts_1.TestModel.class, testArtifacts_1.TestModel);
|
|
22
|
+
nymph.setEntityClass(testArtifacts_1.TestBModel.class, testArtifacts_1.TestBModel);
|
|
22
23
|
let testEntity;
|
|
23
24
|
let testGuid;
|
|
24
25
|
let refGuid;
|
|
@@ -54,10 +55,10 @@ This one's zip code is 92064.`;
|
|
|
54
55
|
expect(yield testEntity.$save()).toEqual(true);
|
|
55
56
|
entityReferenceTest.test = 'good';
|
|
56
57
|
expect(yield entityReferenceTest.$save()).toEqual(true);
|
|
57
|
-
testEntity =
|
|
58
|
+
testEntity = nymph.driver.getEntitySync({ class: testArtifacts_1.TestModel }, testGuid);
|
|
58
59
|
expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
|
|
59
60
|
expect(testEntity.guid).toEqual(testGuid);
|
|
60
|
-
testEntity = (yield
|
|
61
|
+
testEntity = (yield nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
|
|
61
62
|
expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
|
|
62
63
|
expect(testEntity.guid).toEqual(testGuid);
|
|
63
64
|
});
|
|
@@ -78,12 +79,12 @@ This one's zip code is 92064.`;
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
it('delete old test data', () => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
let all = yield
|
|
82
|
+
let all = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
82
83
|
expect(Array.isArray(all)).toEqual(true);
|
|
83
84
|
for (const cur of all) {
|
|
84
85
|
expect(yield cur.$delete()).toEqual(true);
|
|
85
86
|
}
|
|
86
|
-
all = yield
|
|
87
|
+
all = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
87
88
|
expect(all.length).toEqual(0);
|
|
88
89
|
}));
|
|
89
90
|
it('create entity', () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -102,17 +103,17 @@ This one's zip code is 92064.`;
|
|
|
102
103
|
}));
|
|
103
104
|
it('by guid', () => __awaiter(this, void 0, void 0, function* () {
|
|
104
105
|
yield createTestEntities();
|
|
105
|
-
let resultEntity = yield
|
|
106
|
+
let resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
|
|
106
107
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
107
108
|
resultEntity = yield testArtifacts_1.TestModel.factory(testGuid);
|
|
108
109
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
109
|
-
resultEntity = yield
|
|
110
|
+
resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, (0, newGUID_1.default)());
|
|
110
111
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
111
112
|
}));
|
|
112
113
|
it('transactions', () => __awaiter(this, void 0, void 0, function* () {
|
|
113
114
|
yield createTestEntities();
|
|
114
|
-
expect(yield
|
|
115
|
-
let transaction = yield
|
|
115
|
+
expect(yield nymph.inTransaction()).toEqual(false);
|
|
116
|
+
let transaction = yield nymph.startTransaction('test');
|
|
116
117
|
testEntity.$nymph = transaction;
|
|
117
118
|
if (!(yield transaction.inTransaction())) {
|
|
118
119
|
console.log('This Nymph driver or database seems to not support transactions. Skipping transaction tests.');
|
|
@@ -125,7 +126,7 @@ This one's zip code is 92064.`;
|
|
|
125
126
|
expect(yield transaction.inTransaction()).toEqual(false);
|
|
126
127
|
yield testEntity.$refresh();
|
|
127
128
|
expect(testEntity.string).toEqual('test');
|
|
128
|
-
transaction = yield
|
|
129
|
+
transaction = yield nymph.startTransaction('test');
|
|
129
130
|
testEntity.$nymph = transaction;
|
|
130
131
|
expect(yield transaction.inTransaction()).toEqual(true);
|
|
131
132
|
expect(yield testEntity.$delete()).toEqual(true);
|
|
@@ -135,13 +136,13 @@ This one's zip code is 92064.`;
|
|
|
135
136
|
expect(yield transaction.inTransaction()).toEqual(false);
|
|
136
137
|
testEntity = (yield transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
|
|
137
138
|
expect(testEntity.guid).toEqual(testGuid);
|
|
138
|
-
transaction = yield
|
|
139
|
+
transaction = yield nymph.startTransaction('test');
|
|
139
140
|
testEntity.$nymph = transaction;
|
|
140
141
|
expect(yield transaction.inTransaction()).toEqual(true);
|
|
141
142
|
testEntity.string = 'fish';
|
|
142
143
|
expect(yield testEntity.$save()).toEqual(true);
|
|
143
144
|
yield transaction.commit('test');
|
|
144
|
-
testEntity.$nymph =
|
|
145
|
+
testEntity.$nymph = nymph;
|
|
145
146
|
expect(yield transaction.inTransaction()).toEqual(false);
|
|
146
147
|
yield testEntity.$refresh();
|
|
147
148
|
expect(testEntity.string).toEqual('fish');
|
|
@@ -150,7 +151,7 @@ This one's zip code is 92064.`;
|
|
|
150
151
|
}));
|
|
151
152
|
it('options', () => __awaiter(this, void 0, void 0, function* () {
|
|
152
153
|
yield createTestEntities();
|
|
153
|
-
const resultEntities = yield
|
|
154
|
+
const resultEntities = yield nymph.getEntities({
|
|
154
155
|
class: testArtifacts_1.TestModel,
|
|
155
156
|
reverse: true,
|
|
156
157
|
offset: 1,
|
|
@@ -162,174 +163,174 @@ This one's zip code is 92064.`;
|
|
|
162
163
|
}));
|
|
163
164
|
it('guid and tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
164
165
|
yield createTestEntities();
|
|
165
|
-
const resultEntity = yield
|
|
166
|
+
const resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: 'test' });
|
|
166
167
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
167
168
|
}));
|
|
168
169
|
it('or selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
169
170
|
yield createTestEntities();
|
|
170
|
-
const resultEntity = yield
|
|
171
|
+
const resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [testGuid, (0, newGUID_1.default)()] });
|
|
171
172
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
172
173
|
}));
|
|
173
174
|
it('wrong or selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
174
175
|
yield createTestEntities();
|
|
175
|
-
const resultEntity = yield
|
|
176
|
+
const resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [(0, newGUID_1.default)(), (0, newGUID_1.default)()] });
|
|
176
177
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
177
178
|
}));
|
|
178
179
|
it('not guid', () => __awaiter(this, void 0, void 0, function* () {
|
|
179
180
|
yield createTestEntities();
|
|
180
|
-
const resultEntity = yield
|
|
181
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', '!guid': (0, newGUID_1.default)(), tag: 'test' });
|
|
181
182
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
182
183
|
}));
|
|
183
184
|
it('not tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
184
185
|
yield createTestEntities();
|
|
185
|
-
const resultEntity = yield
|
|
186
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
|
|
186
187
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
187
188
|
}));
|
|
188
189
|
it('guid and wrong tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
189
190
|
yield createTestEntities();
|
|
190
|
-
const resultEntity = yield
|
|
191
|
+
const resultEntity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
|
|
191
192
|
expect(resultEntity).toBeNull();
|
|
192
193
|
}));
|
|
193
194
|
it('tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
194
195
|
yield createTestEntities();
|
|
195
|
-
const resultEntity = yield
|
|
196
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' });
|
|
196
197
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
197
198
|
}));
|
|
198
199
|
it('wrong tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
199
200
|
yield createTestEntities();
|
|
200
|
-
const resultEntity = yield
|
|
201
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' });
|
|
201
202
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
202
203
|
}));
|
|
203
204
|
it('inclusive tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
204
205
|
yield createTestEntities();
|
|
205
|
-
const resultEntity = yield
|
|
206
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
|
|
206
207
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
207
208
|
}));
|
|
208
209
|
it('wrong inclusive tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
209
210
|
yield createTestEntities();
|
|
210
|
-
const resultEntity = yield
|
|
211
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
|
|
211
212
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
212
213
|
}));
|
|
213
214
|
it('mixed tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
214
215
|
yield createTestEntities();
|
|
215
|
-
const resultEntity = yield
|
|
216
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
|
|
216
217
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
217
218
|
}));
|
|
218
219
|
it('wrong inclusive mixed tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
219
220
|
yield createTestEntities();
|
|
220
|
-
const resultEntity = yield
|
|
221
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
|
|
221
222
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
222
223
|
}));
|
|
223
224
|
it('wrong exclusive mixed tags', () => __awaiter(this, void 0, void 0, function* () {
|
|
224
225
|
yield createTestEntities();
|
|
225
|
-
const resultEntity = yield
|
|
226
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
|
|
226
227
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
227
228
|
}));
|
|
228
229
|
it('defined', () => __awaiter(this, void 0, void 0, function* () {
|
|
229
230
|
yield createTestEntities();
|
|
230
|
-
const resultEntity = yield
|
|
231
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', defined: 'string' });
|
|
231
232
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
232
233
|
}));
|
|
233
234
|
it('not defined', () => __awaiter(this, void 0, void 0, function* () {
|
|
234
235
|
yield createTestEntities();
|
|
235
|
-
const resultEntity = yield
|
|
236
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
|
|
236
237
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
237
238
|
}));
|
|
238
239
|
it('defined in a not and clause', () => __awaiter(this, void 0, void 0, function* () {
|
|
239
240
|
yield createTestEntities();
|
|
240
|
-
const resultEntity = yield
|
|
241
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
|
|
241
242
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
242
243
|
}));
|
|
243
244
|
it('equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
244
245
|
yield createTestEntities();
|
|
245
|
-
const resultEntity = yield
|
|
246
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', equal: ['string', 'test'] });
|
|
246
247
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
247
248
|
}));
|
|
248
249
|
it('not equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
249
250
|
yield createTestEntities();
|
|
250
251
|
const referenceEntity = yield testArtifacts_1.TestModel.factory(refGuid);
|
|
251
252
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
252
|
-
const resultEntity = yield
|
|
253
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
|
|
253
254
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
254
255
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
255
256
|
}));
|
|
256
257
|
it('like', () => __awaiter(this, void 0, void 0, function* () {
|
|
257
258
|
yield createTestEntities();
|
|
258
|
-
const resultEntity = yield
|
|
259
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 't_s%'] });
|
|
259
260
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
260
261
|
}));
|
|
261
262
|
it('not like', () => __awaiter(this, void 0, void 0, function* () {
|
|
262
263
|
yield createTestEntities();
|
|
263
264
|
const referenceEntity = yield testArtifacts_1.TestModel.factory(refGuid);
|
|
264
265
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
265
|
-
const resultEntity = yield
|
|
266
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
|
|
266
267
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
267
268
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
268
269
|
}));
|
|
269
270
|
it('ilike', () => __awaiter(this, void 0, void 0, function* () {
|
|
270
271
|
yield createTestEntities();
|
|
271
|
-
const resultEntity = yield
|
|
272
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
|
|
272
273
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
273
274
|
}));
|
|
274
275
|
it('not ilike', () => __awaiter(this, void 0, void 0, function* () {
|
|
275
276
|
yield createTestEntities();
|
|
276
277
|
const referenceEntity = yield testArtifacts_1.TestModel.factory(refGuid);
|
|
277
278
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
278
|
-
const resultEntity = yield
|
|
279
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
|
|
279
280
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
280
281
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
281
282
|
}));
|
|
282
283
|
it('like with wrong case', () => __awaiter(this, void 0, void 0, function* () {
|
|
283
284
|
yield createTestEntities();
|
|
284
|
-
const resultEntity = yield
|
|
285
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 'T_s%'] });
|
|
285
286
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
286
287
|
}));
|
|
287
288
|
it('tags and equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
288
289
|
yield createTestEntities();
|
|
289
|
-
const resultEntity = yield
|
|
290
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
|
|
290
291
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
291
292
|
}));
|
|
292
293
|
it('wrong tags right equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
293
294
|
yield createTestEntities();
|
|
294
|
-
const resultEntity = yield
|
|
295
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
|
|
295
296
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
296
297
|
}));
|
|
297
298
|
it('right tags wrong equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
298
299
|
yield createTestEntities();
|
|
299
|
-
const resultEntity = yield
|
|
300
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
|
|
300
301
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
301
302
|
}));
|
|
302
303
|
it('wrong tags wrong equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
303
304
|
yield createTestEntities();
|
|
304
|
-
const resultEntity = yield
|
|
305
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
|
|
305
306
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
306
307
|
}));
|
|
307
308
|
it('contain', () => __awaiter(this, void 0, void 0, function* () {
|
|
308
309
|
yield createTestEntities();
|
|
309
|
-
let resultEntity = yield
|
|
310
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'values'] });
|
|
310
311
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
311
|
-
resultEntity = yield
|
|
312
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'test'] });
|
|
312
313
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
313
314
|
}));
|
|
314
315
|
it('not contain', () => __awaiter(this, void 0, void 0, function* () {
|
|
315
316
|
yield createTestEntities();
|
|
316
|
-
const resultEntity = yield
|
|
317
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
|
|
317
318
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
318
319
|
}));
|
|
319
320
|
it('wrong contain', () => __awaiter(this, void 0, void 0, function* () {
|
|
320
321
|
yield createTestEntities();
|
|
321
|
-
let resultEntity = yield
|
|
322
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'pickles'] });
|
|
322
323
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
323
|
-
resultEntity = yield
|
|
324
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'pickles'] });
|
|
324
325
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
325
326
|
}));
|
|
326
327
|
it('match', () => __awaiter(this, void 0, void 0, function* () {
|
|
327
328
|
yield createTestEntities();
|
|
328
|
-
let resultEntity = yield
|
|
329
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', '.*'] });
|
|
329
330
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
330
|
-
resultEntity = yield
|
|
331
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
|
|
331
332
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
332
|
-
resultEntity = yield
|
|
333
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, {
|
|
333
334
|
type: '|',
|
|
334
335
|
match: [
|
|
335
336
|
['string', '[0-9]'],
|
|
@@ -337,13 +338,13 @@ This one's zip code is 92064.`;
|
|
|
337
338
|
],
|
|
338
339
|
});
|
|
339
340
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
340
|
-
resultEntity = yield
|
|
341
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
341
342
|
type: '&',
|
|
342
343
|
tag: 'test',
|
|
343
344
|
match: ['match', '[-a-zA-Z0-9+_]+@[-a-zA-Z0-9_]+.[-a-zA-Z0-9_]{2,4}'],
|
|
344
345
|
});
|
|
345
346
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
346
|
-
resultEntity = yield
|
|
347
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
347
348
|
type: '&',
|
|
348
349
|
tag: 'test',
|
|
349
350
|
match: ['match', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'],
|
|
@@ -352,16 +353,16 @@ This one's zip code is 92064.`;
|
|
|
352
353
|
}));
|
|
353
354
|
it('imatch', () => __awaiter(this, void 0, void 0, function* () {
|
|
354
355
|
yield createTestEntities();
|
|
355
|
-
const resultEntity = yield
|
|
356
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
|
|
356
357
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
357
358
|
}));
|
|
358
359
|
it('wrong match', () => __awaiter(this, void 0, void 0, function* () {
|
|
359
360
|
yield createTestEntities();
|
|
360
|
-
let resultEntity = yield
|
|
361
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', 'Q'] });
|
|
361
362
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
362
|
-
resultEntity = yield
|
|
363
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
|
|
363
364
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
364
|
-
resultEntity = yield
|
|
365
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
365
366
|
type: '|',
|
|
366
367
|
match: [
|
|
367
368
|
['string', '[0-9]'],
|
|
@@ -372,17 +373,17 @@ This one's zip code is 92064.`;
|
|
|
372
373
|
}));
|
|
373
374
|
it('match wrong case', () => __awaiter(this, void 0, void 0, function* () {
|
|
374
375
|
yield createTestEntities();
|
|
375
|
-
const resultEntity = yield
|
|
376
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
|
|
376
377
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
377
378
|
}));
|
|
378
379
|
it('match and equal inclusive', () => __awaiter(this, void 0, void 0, function* () {
|
|
379
380
|
yield createTestEntities();
|
|
380
|
-
const resultEntity = yield
|
|
381
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
|
|
381
382
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
382
383
|
}));
|
|
383
384
|
it('greater than', () => __awaiter(this, void 0, void 0, function* () {
|
|
384
385
|
yield createTestEntities();
|
|
385
|
-
let resultEntity = yield
|
|
386
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
386
387
|
type: '|',
|
|
387
388
|
gt: [
|
|
388
389
|
['number', 30],
|
|
@@ -390,7 +391,7 @@ This one's zip code is 92064.`;
|
|
|
390
391
|
],
|
|
391
392
|
});
|
|
392
393
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
393
|
-
resultEntity = yield
|
|
394
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
394
395
|
type: '|',
|
|
395
396
|
gt: [
|
|
396
397
|
['number', 31],
|
|
@@ -398,7 +399,7 @@ This one's zip code is 92064.`;
|
|
|
398
399
|
],
|
|
399
400
|
});
|
|
400
401
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
401
|
-
resultEntity = yield
|
|
402
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
402
403
|
type: '|',
|
|
403
404
|
gt: [
|
|
404
405
|
['number', 29],
|
|
@@ -406,7 +407,7 @@ This one's zip code is 92064.`;
|
|
|
406
407
|
],
|
|
407
408
|
});
|
|
408
409
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
409
|
-
resultEntity = yield
|
|
410
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
410
411
|
type: '|',
|
|
411
412
|
gt: [
|
|
412
413
|
['numberString', 30],
|
|
@@ -414,7 +415,7 @@ This one's zip code is 92064.`;
|
|
|
414
415
|
],
|
|
415
416
|
});
|
|
416
417
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
417
|
-
resultEntity = yield
|
|
418
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
418
419
|
type: '|',
|
|
419
420
|
gt: [
|
|
420
421
|
['numberString', 31],
|
|
@@ -422,7 +423,7 @@ This one's zip code is 92064.`;
|
|
|
422
423
|
],
|
|
423
424
|
});
|
|
424
425
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
425
|
-
resultEntity = yield
|
|
426
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
426
427
|
type: '|',
|
|
427
428
|
gt: [
|
|
428
429
|
['numberString', 29],
|
|
@@ -433,7 +434,7 @@ This one's zip code is 92064.`;
|
|
|
433
434
|
}));
|
|
434
435
|
it('greater than or equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
435
436
|
yield createTestEntities();
|
|
436
|
-
let resultEntity = yield
|
|
437
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
437
438
|
type: '|',
|
|
438
439
|
gte: [
|
|
439
440
|
['number', 30],
|
|
@@ -441,7 +442,7 @@ This one's zip code is 92064.`;
|
|
|
441
442
|
],
|
|
442
443
|
});
|
|
443
444
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
444
|
-
resultEntity = yield
|
|
445
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
445
446
|
type: '|',
|
|
446
447
|
gte: [
|
|
447
448
|
['number', 31],
|
|
@@ -449,7 +450,7 @@ This one's zip code is 92064.`;
|
|
|
449
450
|
],
|
|
450
451
|
});
|
|
451
452
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
452
|
-
resultEntity = yield
|
|
453
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
453
454
|
type: '|',
|
|
454
455
|
gte: [
|
|
455
456
|
['number', 29],
|
|
@@ -457,7 +458,7 @@ This one's zip code is 92064.`;
|
|
|
457
458
|
],
|
|
458
459
|
});
|
|
459
460
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
460
|
-
resultEntity = yield
|
|
461
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
461
462
|
type: '|',
|
|
462
463
|
gte: [
|
|
463
464
|
['numberString', 30],
|
|
@@ -465,7 +466,7 @@ This one's zip code is 92064.`;
|
|
|
465
466
|
],
|
|
466
467
|
});
|
|
467
468
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
468
|
-
resultEntity = yield
|
|
469
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
469
470
|
type: '|',
|
|
470
471
|
gte: [
|
|
471
472
|
['numberString', 31],
|
|
@@ -473,7 +474,7 @@ This one's zip code is 92064.`;
|
|
|
473
474
|
],
|
|
474
475
|
});
|
|
475
476
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
476
|
-
resultEntity = yield
|
|
477
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
477
478
|
type: '|',
|
|
478
479
|
gte: [
|
|
479
480
|
['numberString', 29],
|
|
@@ -484,7 +485,7 @@ This one's zip code is 92064.`;
|
|
|
484
485
|
}));
|
|
485
486
|
it('less than', () => __awaiter(this, void 0, void 0, function* () {
|
|
486
487
|
yield createTestEntities();
|
|
487
|
-
let resultEntity = yield
|
|
488
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
488
489
|
type: '|',
|
|
489
490
|
lt: [
|
|
490
491
|
['number', 30],
|
|
@@ -492,7 +493,7 @@ This one's zip code is 92064.`;
|
|
|
492
493
|
],
|
|
493
494
|
});
|
|
494
495
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
495
|
-
resultEntity = yield
|
|
496
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
496
497
|
type: '|',
|
|
497
498
|
lt: [
|
|
498
499
|
['number', 31],
|
|
@@ -500,7 +501,7 @@ This one's zip code is 92064.`;
|
|
|
500
501
|
],
|
|
501
502
|
});
|
|
502
503
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
503
|
-
resultEntity = yield
|
|
504
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
504
505
|
type: '|',
|
|
505
506
|
lt: [
|
|
506
507
|
['number', 29],
|
|
@@ -508,7 +509,7 @@ This one's zip code is 92064.`;
|
|
|
508
509
|
],
|
|
509
510
|
});
|
|
510
511
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
511
|
-
resultEntity = yield
|
|
512
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
512
513
|
type: '|',
|
|
513
514
|
lt: [
|
|
514
515
|
['numberString', 30],
|
|
@@ -516,7 +517,7 @@ This one's zip code is 92064.`;
|
|
|
516
517
|
],
|
|
517
518
|
});
|
|
518
519
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
519
|
-
resultEntity = yield
|
|
520
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
520
521
|
type: '|',
|
|
521
522
|
lt: [
|
|
522
523
|
['numberString', 31],
|
|
@@ -524,7 +525,7 @@ This one's zip code is 92064.`;
|
|
|
524
525
|
],
|
|
525
526
|
});
|
|
526
527
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
527
|
-
resultEntity = yield
|
|
528
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
528
529
|
type: '|',
|
|
529
530
|
lt: [
|
|
530
531
|
['numberString', 29],
|
|
@@ -535,7 +536,7 @@ This one's zip code is 92064.`;
|
|
|
535
536
|
}));
|
|
536
537
|
it('less than or equal', () => __awaiter(this, void 0, void 0, function* () {
|
|
537
538
|
yield createTestEntities();
|
|
538
|
-
let resultEntity = yield
|
|
539
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
539
540
|
type: '|',
|
|
540
541
|
lte: [
|
|
541
542
|
['number', 30],
|
|
@@ -543,7 +544,7 @@ This one's zip code is 92064.`;
|
|
|
543
544
|
],
|
|
544
545
|
});
|
|
545
546
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
546
|
-
resultEntity = yield
|
|
547
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
547
548
|
type: '|',
|
|
548
549
|
lte: [
|
|
549
550
|
['number', 31],
|
|
@@ -551,7 +552,7 @@ This one's zip code is 92064.`;
|
|
|
551
552
|
],
|
|
552
553
|
});
|
|
553
554
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
554
|
-
resultEntity = yield
|
|
555
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
555
556
|
type: '|',
|
|
556
557
|
lte: [
|
|
557
558
|
['number', 29],
|
|
@@ -559,7 +560,7 @@ This one's zip code is 92064.`;
|
|
|
559
560
|
],
|
|
560
561
|
});
|
|
561
562
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
562
|
-
resultEntity = yield
|
|
563
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
563
564
|
type: '|',
|
|
564
565
|
lte: [
|
|
565
566
|
['numberString', 30],
|
|
@@ -567,7 +568,7 @@ This one's zip code is 92064.`;
|
|
|
567
568
|
],
|
|
568
569
|
});
|
|
569
570
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
570
|
-
resultEntity = yield
|
|
571
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
571
572
|
type: '|',
|
|
572
573
|
lte: [
|
|
573
574
|
['numberString', 31],
|
|
@@ -575,7 +576,7 @@ This one's zip code is 92064.`;
|
|
|
575
576
|
],
|
|
576
577
|
});
|
|
577
578
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
578
|
-
resultEntity = yield
|
|
579
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
579
580
|
type: '|',
|
|
580
581
|
lte: [
|
|
581
582
|
['numberString', 29],
|
|
@@ -586,33 +587,33 @@ This one's zip code is 92064.`;
|
|
|
586
587
|
}));
|
|
587
588
|
it('not inequality', () => __awaiter(this, void 0, void 0, function* () {
|
|
588
589
|
yield createTestEntities();
|
|
589
|
-
const resultEntity = yield
|
|
590
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
|
|
590
591
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
591
592
|
}));
|
|
592
593
|
it('wrong inequality', () => __awaiter(this, void 0, void 0, function* () {
|
|
593
594
|
yield createTestEntities();
|
|
594
|
-
const resultEntity = yield
|
|
595
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', lte: ['number', 29.99] });
|
|
595
596
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
596
597
|
}));
|
|
597
598
|
it('greater than cdate', () => __awaiter(this, void 0, void 0, function* () {
|
|
598
599
|
var _b;
|
|
599
600
|
yield createTestEntities();
|
|
600
|
-
const resultEntity = yield
|
|
601
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', ((_b = testEntity.cdate) !== null && _b !== void 0 ? _b : 0) - 120] });
|
|
601
602
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
602
603
|
}));
|
|
603
604
|
it('wrong cdate', () => __awaiter(this, void 0, void 0, function* () {
|
|
604
605
|
var _c;
|
|
605
606
|
yield createTestEntities();
|
|
606
|
-
const resultEntity = yield
|
|
607
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gte: ['cdate', ((_c = testEntity.cdate) !== null && _c !== void 0 ? _c : 0) + 1] });
|
|
607
608
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
608
609
|
}));
|
|
609
610
|
it('time selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
610
611
|
yield createTestEntities();
|
|
611
612
|
const referenceEntity = yield testArtifacts_1.TestModel.factory(refGuid);
|
|
612
|
-
let resultEntity = yield
|
|
613
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-1 day'] });
|
|
613
614
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
614
615
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
615
|
-
resultEntity = yield
|
|
616
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
616
617
|
type: '|',
|
|
617
618
|
gt: [
|
|
618
619
|
['timestamp', null, '-1 day'],
|
|
@@ -621,23 +622,23 @@ This one's zip code is 92064.`;
|
|
|
621
622
|
});
|
|
622
623
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
623
624
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
624
|
-
resultEntity = yield
|
|
625
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
|
|
625
626
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
626
627
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
627
|
-
resultEntity = yield
|
|
628
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
|
|
628
629
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
629
630
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
630
631
|
}));
|
|
631
632
|
it('wrong time selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
632
633
|
yield createTestEntities();
|
|
633
634
|
const referenceEntity = yield testArtifacts_1.TestModel.factory(refGuid);
|
|
634
|
-
let resultEntity = yield
|
|
635
|
+
let resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] });
|
|
635
636
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
636
637
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
637
|
-
resultEntity = yield
|
|
638
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
|
|
638
639
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
639
640
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
640
|
-
resultEntity = yield
|
|
641
|
+
resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
|
|
641
642
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
642
643
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
643
644
|
}));
|
|
@@ -649,27 +650,27 @@ This one's zip code is 92064.`;
|
|
|
649
650
|
}));
|
|
650
651
|
it('ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
651
652
|
yield createTestEntities();
|
|
652
|
-
const resultEntity = yield
|
|
653
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
|
|
653
654
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
654
655
|
}));
|
|
655
656
|
it('not ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
656
657
|
yield createTestEntities();
|
|
657
|
-
const resultEntity = yield
|
|
658
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', (0, newGUID_1.default)()] });
|
|
658
659
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
659
660
|
}));
|
|
660
661
|
it('wrong ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
661
662
|
yield createTestEntities();
|
|
662
|
-
const resultEntity = yield
|
|
663
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', (0, newGUID_1.default)()] });
|
|
663
664
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
664
665
|
}));
|
|
665
666
|
it('nonexistent ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
666
667
|
yield createTestEntities();
|
|
667
|
-
const resultEntity = yield
|
|
668
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['pickle', refGuid] });
|
|
668
669
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
669
670
|
}));
|
|
670
671
|
it('inclusive ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
671
672
|
yield createTestEntities();
|
|
672
|
-
const resultEntity = yield
|
|
673
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
673
674
|
type: '|',
|
|
674
675
|
ref: [
|
|
675
676
|
['reference', refGuid],
|
|
@@ -680,7 +681,7 @@ This one's zip code is 92064.`;
|
|
|
680
681
|
}));
|
|
681
682
|
it('wrong inclusive ref', () => __awaiter(this, void 0, void 0, function* () {
|
|
682
683
|
yield createTestEntities();
|
|
683
|
-
const resultEntity = yield
|
|
684
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
684
685
|
type: '|',
|
|
685
686
|
ref: [
|
|
686
687
|
['reference', (0, newGUID_1.default)()],
|
|
@@ -691,12 +692,12 @@ This one's zip code is 92064.`;
|
|
|
691
692
|
}));
|
|
692
693
|
it('ref in an array', () => __awaiter(this, void 0, void 0, function* () {
|
|
693
694
|
yield createTestEntities();
|
|
694
|
-
const resultEntity = yield
|
|
695
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['refArray', refGuid] });
|
|
695
696
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
696
697
|
}));
|
|
697
698
|
it('wrong ref in an array', () => __awaiter(this, void 0, void 0, function* () {
|
|
698
699
|
yield createTestEntities();
|
|
699
|
-
const resultEntity = yield
|
|
700
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
700
701
|
type: '&',
|
|
701
702
|
ref: [
|
|
702
703
|
['refArray', refGuid],
|
|
@@ -707,7 +708,7 @@ This one's zip code is 92064.`;
|
|
|
707
708
|
}));
|
|
708
709
|
it('logic operations', () => __awaiter(this, void 0, void 0, function* () {
|
|
709
710
|
yield createTestEntities();
|
|
710
|
-
const resultEntity = yield
|
|
711
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
711
712
|
type: '&',
|
|
712
713
|
'!ref': [
|
|
713
714
|
['refArray', (0, newGUID_1.default)()],
|
|
@@ -744,7 +745,7 @@ This one's zip code is 92064.`;
|
|
|
744
745
|
it('guid return', () => __awaiter(this, void 0, void 0, function* () {
|
|
745
746
|
var _f;
|
|
746
747
|
yield createTestEntities();
|
|
747
|
-
const resultGuid = yield
|
|
748
|
+
const resultGuid = yield nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'guid' }, {
|
|
748
749
|
type: '&',
|
|
749
750
|
'!ref': [
|
|
750
751
|
['refArray', (0, newGUID_1.default)()],
|
|
@@ -780,7 +781,7 @@ This one's zip code is 92064.`;
|
|
|
780
781
|
}));
|
|
781
782
|
it('deep selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
782
783
|
yield createTestEntities();
|
|
783
|
-
const resultEntity = yield
|
|
784
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
784
785
|
type: '&',
|
|
785
786
|
'!ref': [
|
|
786
787
|
['refArray', (0, newGUID_1.default)()],
|
|
@@ -820,7 +821,7 @@ This one's zip code is 92064.`;
|
|
|
820
821
|
],
|
|
821
822
|
});
|
|
822
823
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
823
|
-
const resultEntity2 = yield
|
|
824
|
+
const resultEntity2 = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
824
825
|
type: '&',
|
|
825
826
|
'!ref': [
|
|
826
827
|
['refArray', (0, newGUID_1.default)()],
|
|
@@ -860,7 +861,7 @@ This one's zip code is 92064.`;
|
|
|
860
861
|
],
|
|
861
862
|
});
|
|
862
863
|
expect(testEntity.$inArray(resultEntity2)).toEqual(true);
|
|
863
|
-
const resultEntity3 = yield
|
|
864
|
+
const resultEntity3 = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
864
865
|
type: '|',
|
|
865
866
|
selector: [
|
|
866
867
|
{
|
|
@@ -872,7 +873,7 @@ This one's zip code is 92064.`;
|
|
|
872
873
|
],
|
|
873
874
|
});
|
|
874
875
|
expect(testEntity.$inArray(resultEntity3)).toEqual(true);
|
|
875
|
-
const resultEntity4 = yield
|
|
876
|
+
const resultEntity4 = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
876
877
|
type: '|',
|
|
877
878
|
selector: [
|
|
878
879
|
{
|
|
@@ -892,7 +893,7 @@ This one's zip code is 92064.`;
|
|
|
892
893
|
expect(testEntity.$inArray(resultEntity4)).toEqual(true);
|
|
893
894
|
}));
|
|
894
895
|
it('wrong deep selector', () => __awaiter(this, void 0, void 0, function* () {
|
|
895
|
-
const resultEntity = yield
|
|
896
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
896
897
|
type: '&',
|
|
897
898
|
selector: [
|
|
898
899
|
{
|
|
@@ -907,7 +908,7 @@ This one's zip code is 92064.`;
|
|
|
907
908
|
}));
|
|
908
909
|
it('qref', () => __awaiter(this, void 0, void 0, function* () {
|
|
909
910
|
yield createTestEntities();
|
|
910
|
-
const resultEntity = yield
|
|
911
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
911
912
|
type: '&',
|
|
912
913
|
qref: [
|
|
913
914
|
'reference',
|
|
@@ -918,7 +919,7 @@ This one's zip code is 92064.`;
|
|
|
918
919
|
}));
|
|
919
920
|
it('not qref', () => __awaiter(this, void 0, void 0, function* () {
|
|
920
921
|
yield createTestEntities();
|
|
921
|
-
const resultEntity = yield
|
|
922
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
922
923
|
type: '&',
|
|
923
924
|
'!qref': [
|
|
924
925
|
'reference',
|
|
@@ -929,7 +930,7 @@ This one's zip code is 92064.`;
|
|
|
929
930
|
}));
|
|
930
931
|
it('wrong qref class', () => __awaiter(this, void 0, void 0, function* () {
|
|
931
932
|
yield createTestEntities();
|
|
932
|
-
const resultEntity = yield
|
|
933
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
933
934
|
type: '&',
|
|
934
935
|
qref: [
|
|
935
936
|
'reference',
|
|
@@ -940,7 +941,7 @@ This one's zip code is 92064.`;
|
|
|
940
941
|
}));
|
|
941
942
|
it('wrong qref data', () => __awaiter(this, void 0, void 0, function* () {
|
|
942
943
|
yield createTestEntities();
|
|
943
|
-
const resultEntity = yield
|
|
944
|
+
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
944
945
|
type: '&',
|
|
945
946
|
qref: [
|
|
946
947
|
'reference',
|
|
@@ -953,7 +954,7 @@ This one's zip code is 92064.`;
|
|
|
953
954
|
var _g, _h, _j, _k;
|
|
954
955
|
yield createMultipleTestEntities();
|
|
955
956
|
for (const sort of ['cdate', 'mdate']) {
|
|
956
|
-
let resultEntities = yield
|
|
957
|
+
let resultEntities = yield nymph.getEntities({
|
|
957
958
|
class: testArtifacts_1.TestModel,
|
|
958
959
|
sort: sort,
|
|
959
960
|
});
|
|
@@ -961,7 +962,7 @@ This one's zip code is 92064.`;
|
|
|
961
962
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
962
963
|
expect(resultEntities[i + 1][sort]).toBeGreaterThan((_g = resultEntities[i][sort]) !== null && _g !== void 0 ? _g : 0);
|
|
963
964
|
}
|
|
964
|
-
let resultGuids = yield
|
|
965
|
+
let resultGuids = yield nymph.getEntities({
|
|
965
966
|
class: testArtifacts_1.TestModel,
|
|
966
967
|
sort: sort,
|
|
967
968
|
return: 'guid',
|
|
@@ -970,7 +971,7 @@ This one's zip code is 92064.`;
|
|
|
970
971
|
for (let i = 0; i < resultGuids.length - 1; i++) {
|
|
971
972
|
expect(resultGuids[i]).toEqual(resultEntities[i].guid);
|
|
972
973
|
}
|
|
973
|
-
resultEntities = yield
|
|
974
|
+
resultEntities = yield nymph.getEntities({
|
|
974
975
|
class: testArtifacts_1.TestModel,
|
|
975
976
|
sort: sort,
|
|
976
977
|
reverse: true,
|
|
@@ -979,12 +980,12 @@ This one's zip code is 92064.`;
|
|
|
979
980
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
980
981
|
expect(resultEntities[i + 1][sort]).toBeLessThan((_h = resultEntities[i][sort]) !== null && _h !== void 0 ? _h : 0);
|
|
981
982
|
}
|
|
982
|
-
resultEntities = yield
|
|
983
|
+
resultEntities = yield nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort }, { type: '&', match: ['name', '^Multi Test '] });
|
|
983
984
|
expect(resultEntities.length).toEqual(100);
|
|
984
985
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
985
986
|
expect(resultEntities[i + 1][sort]).toBeGreaterThan((_j = resultEntities[i][sort]) !== null && _j !== void 0 ? _j : 0);
|
|
986
987
|
}
|
|
987
|
-
resultEntities = yield
|
|
988
|
+
resultEntities = yield nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
|
|
988
989
|
expect(resultEntities.length).toEqual(100);
|
|
989
990
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
990
991
|
expect(resultEntities[i + 1][sort]).toBeLessThan((_k = resultEntities[i][sort]) !== null && _k !== void 0 ? _k : 0);
|
|
@@ -1001,71 +1002,75 @@ This one's zip code is 92064.`;
|
|
|
1001
1002
|
yield createTestEntities();
|
|
1002
1003
|
expect(yield testEntity.$delete()).toEqual(true);
|
|
1003
1004
|
expect(testEntity.guid).toBeNull();
|
|
1004
|
-
const entity = yield
|
|
1005
|
+
const entity = yield nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid });
|
|
1005
1006
|
expect(entity).toBeNull();
|
|
1006
1007
|
}));
|
|
1007
1008
|
}
|
|
1008
1009
|
exports.QueriesTest = QueriesTest;
|
|
1009
|
-
function UIDTest(it) {
|
|
1010
|
+
function UIDTest(nymph, it) {
|
|
1011
|
+
nymph.setEntityClass(testArtifacts_1.TestModel.class, testArtifacts_1.TestModel);
|
|
1012
|
+
nymph.setEntityClass(testArtifacts_1.TestBModel.class, testArtifacts_1.TestBModel);
|
|
1010
1013
|
it('delete old test data', () => __awaiter(this, void 0, void 0, function* () {
|
|
1011
|
-
expect(yield
|
|
1012
|
-
expect(yield
|
|
1014
|
+
expect(yield nymph.deleteUID('TestUID')).toEqual(true);
|
|
1015
|
+
expect(yield nymph.deleteUID('NewUID')).toEqual(true);
|
|
1013
1016
|
}));
|
|
1014
1017
|
it('new UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1015
|
-
expect(yield
|
|
1018
|
+
expect(yield nymph.newUID('TestUID')).toEqual(1);
|
|
1016
1019
|
}));
|
|
1017
1020
|
it('increment UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1018
|
-
expect(yield
|
|
1021
|
+
expect(yield nymph.newUID('TestUID')).toEqual(2);
|
|
1019
1022
|
}));
|
|
1020
1023
|
it('retrieve UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1021
|
-
expect(yield
|
|
1024
|
+
expect(yield nymph.getUID('TestUID')).toEqual(2);
|
|
1022
1025
|
}));
|
|
1023
1026
|
it('rename UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1024
|
-
expect(yield
|
|
1025
|
-
expect(yield
|
|
1026
|
-
expect(yield
|
|
1027
|
-
expect(yield
|
|
1028
|
-
expect(yield
|
|
1029
|
-
expect(yield
|
|
1027
|
+
expect(yield nymph.renameUID('TestUID', 'NewUID')).toEqual(true);
|
|
1028
|
+
expect(yield nymph.getUID('TestUID')).toBeNull();
|
|
1029
|
+
expect(yield nymph.getUID('NewUID')).toEqual(2);
|
|
1030
|
+
expect(yield nymph.renameUID('NewUID', 'TestUID')).toEqual(true);
|
|
1031
|
+
expect(yield nymph.getUID('NewUID')).toBeNull();
|
|
1032
|
+
expect(yield nymph.getUID('TestUID')).toEqual(2);
|
|
1030
1033
|
}));
|
|
1031
1034
|
it('set UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1032
|
-
expect(yield
|
|
1033
|
-
expect(yield
|
|
1035
|
+
expect(yield nymph.setUID('TestUID', 5)).toEqual(true);
|
|
1036
|
+
expect(yield nymph.getUID('TestUID')).toEqual(5);
|
|
1034
1037
|
}));
|
|
1035
1038
|
it('delete UID', () => __awaiter(this, void 0, void 0, function* () {
|
|
1036
|
-
expect(yield
|
|
1037
|
-
expect(yield
|
|
1039
|
+
expect(yield nymph.deleteUID('TestUID')).toEqual(true);
|
|
1040
|
+
expect(yield nymph.getUID('TestUID')).toBeNull();
|
|
1038
1041
|
}));
|
|
1039
1042
|
}
|
|
1040
1043
|
exports.UIDTest = UIDTest;
|
|
1041
|
-
function ExportImportTest(it) {
|
|
1044
|
+
function ExportImportTest(nymph, it) {
|
|
1045
|
+
nymph.setEntityClass(testArtifacts_1.TestModel.class, testArtifacts_1.TestModel);
|
|
1046
|
+
nymph.setEntityClass(testArtifacts_1.TestBModel.class, testArtifacts_1.TestBModel);
|
|
1042
1047
|
function deleteTestData() {
|
|
1043
1048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1044
|
-
let all = yield
|
|
1049
|
+
let all = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1045
1050
|
expect(Array.isArray(all)).toEqual(true);
|
|
1046
1051
|
for (const cur of all) {
|
|
1047
1052
|
expect(yield cur.$delete()).toEqual(true);
|
|
1048
1053
|
}
|
|
1049
|
-
all = yield
|
|
1054
|
+
all = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1050
1055
|
expect(all.length).toEqual(0);
|
|
1051
|
-
all = yield
|
|
1056
|
+
all = yield nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1052
1057
|
expect(Array.isArray(all)).toEqual(true);
|
|
1053
1058
|
for (const cur of all) {
|
|
1054
1059
|
expect(yield cur.$delete()).toEqual(true);
|
|
1055
1060
|
}
|
|
1056
|
-
all = yield
|
|
1061
|
+
all = yield nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1057
1062
|
expect(all.length).toEqual(0);
|
|
1058
|
-
expect(yield
|
|
1059
|
-
expect(yield
|
|
1063
|
+
expect(yield nymph.deleteUID('TestUID')).toEqual(true);
|
|
1064
|
+
expect(yield nymph.deleteUID('TestUID2')).toEqual(true);
|
|
1060
1065
|
});
|
|
1061
1066
|
}
|
|
1062
1067
|
function checkEntityDataAndCount() {
|
|
1063
1068
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1064
1069
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
-
expect(yield
|
|
1066
|
-
expect(yield
|
|
1067
|
-
const models = yield
|
|
1068
|
-
const bmodels = yield
|
|
1070
|
+
expect(yield nymph.getUID('TestUID')).toEqual(2);
|
|
1071
|
+
expect(yield nymph.getUID('TestUID2')).toEqual(1);
|
|
1072
|
+
const models = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1073
|
+
const bmodels = yield nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1069
1074
|
expect(models.length).toEqual(30);
|
|
1070
1075
|
expect(bmodels.length).toEqual(10);
|
|
1071
1076
|
const all = [...models, ...bmodels];
|
|
@@ -1089,9 +1094,9 @@ function ExportImportTest(it) {
|
|
|
1089
1094
|
yield deleteTestData();
|
|
1090
1095
|
}));
|
|
1091
1096
|
it('setup data', () => __awaiter(this, void 0, void 0, function* () {
|
|
1092
|
-
expect(yield
|
|
1093
|
-
expect(yield
|
|
1094
|
-
expect(yield
|
|
1097
|
+
expect(yield nymph.newUID('TestUID')).toEqual(1);
|
|
1098
|
+
expect(yield nymph.newUID('TestUID')).toEqual(2);
|
|
1099
|
+
expect(yield nymph.newUID('TestUID2')).toEqual(1);
|
|
1095
1100
|
for (let i = 0; i < 20; i++) {
|
|
1096
1101
|
const EntityClass = i < 15 ? testArtifacts_1.TestModel : testArtifacts_1.TestBModel;
|
|
1097
1102
|
const testEntity = yield EntityClass.factory();
|
|
@@ -1113,19 +1118,19 @@ function ExportImportTest(it) {
|
|
|
1113
1118
|
yield checkEntityDataAndCount();
|
|
1114
1119
|
}));
|
|
1115
1120
|
it('export data', () => __awaiter(this, void 0, void 0, function* () {
|
|
1116
|
-
expect(yield
|
|
1121
|
+
expect(yield nymph.export(__dirname + '/testentityexport.nex')).toEqual(true);
|
|
1117
1122
|
}));
|
|
1118
1123
|
it('delete test data again', () => __awaiter(this, void 0, void 0, function* () {
|
|
1119
1124
|
yield deleteTestData();
|
|
1120
1125
|
}));
|
|
1121
1126
|
it('import data', () => __awaiter(this, void 0, void 0, function* () {
|
|
1122
|
-
expect(yield
|
|
1123
|
-
expect(yield
|
|
1124
|
-
const models = yield
|
|
1125
|
-
const bmodels = yield
|
|
1127
|
+
expect(yield nymph.getUID('TestUID')).toBeNull();
|
|
1128
|
+
expect(yield nymph.getUID('TestUID2')).toBeNull();
|
|
1129
|
+
const models = yield nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1130
|
+
const bmodels = yield nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1126
1131
|
expect(models.length).toEqual(0);
|
|
1127
1132
|
expect(bmodels.length).toEqual(0);
|
|
1128
|
-
expect(yield
|
|
1133
|
+
expect(yield nymph.import(__dirname + '/testentityexport.nex')).toEqual(true);
|
|
1129
1134
|
yield checkEntityDataAndCount();
|
|
1130
1135
|
fs_1.default.unlinkSync(__dirname + '/testentityexport.nex');
|
|
1131
1136
|
}));
|