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