@nymphjs/nymph 1.0.0-beta.0 → 1.0.0-beta.2
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 +12 -0
- package/dist/Entity.js +55 -64
- package/dist/Entity.js.map +1 -1
- package/dist/Entity.test.js +73 -86
- package/dist/Entity.test.js.map +1 -1
- package/dist/Nymph.js +137 -187
- package/dist/Nymph.js.map +1 -1
- package/dist/Nymph.types.d.ts +19 -19
- package/dist/Nymph.types.js.map +1 -1
- package/dist/driver/NymphDriver.js +123 -141
- package/dist/driver/NymphDriver.js.map +1 -1
- package/dist/driver/testArtifacts.js +510 -535
- package/dist/driver/testArtifacts.js.map +1 -1
- package/dist/testArtifacts.js +4 -23
- package/dist/testArtifacts.js.map +1 -1
- package/dist/testMocks.js +30 -47
- package/dist/testMocks.js.map +1 -1
- package/dist/utils.js +3 -4
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/Nymph.ts +19 -19
- package/src/Nymph.types.ts +25 -19
- package/tsconfig.json +2 -0
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -24,134 +15,129 @@ function QueriesTest(nymph, it) {
|
|
|
24
15
|
let testGuid;
|
|
25
16
|
let refGuid;
|
|
26
17
|
let createdMultiple = false;
|
|
27
|
-
function createTestEntities() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
testEntity.match = `Hello, my name is Edward McCheese. It is a pleasure to meet you. As you can see, I have several hats of the most pleasant nature.
|
|
18
|
+
async function createTestEntities() {
|
|
19
|
+
if (testGuid != null) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
testEntity = await testArtifacts_1.TestModel.factory();
|
|
23
|
+
testEntity.name = 'Entity Test ' + new Date().toLocaleString();
|
|
24
|
+
testEntity.null = null;
|
|
25
|
+
testEntity.string = 'test';
|
|
26
|
+
testEntity.array = ['full', 'of', 'values', 500];
|
|
27
|
+
testEntity.match = `Hello, my name is Edward McCheese. It is a pleasure to meet you. As you can see, I have several hats of the most pleasant nature.
|
|
38
28
|
|
|
39
29
|
This one's email address is nice_hat-wednesday+newyork@im-a-hat.hat.
|
|
40
30
|
This one's phone number is (555) 555-1818.
|
|
41
31
|
This one's zip code is 92064.`;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
32
|
+
testEntity.number = 30;
|
|
33
|
+
testEntity.numberString = '30';
|
|
34
|
+
testEntity.timestamp = Date.now();
|
|
35
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
36
|
+
expect(testEntity.guid).not.toBeNull();
|
|
37
|
+
testGuid = testEntity.guid;
|
|
38
|
+
const entityReferenceTest = new testArtifacts_1.TestModel();
|
|
39
|
+
entityReferenceTest.string = 'wrong';
|
|
40
|
+
entityReferenceTest.timestamp = (0, strtotime_1.default)('-2 days') * 1000;
|
|
41
|
+
expect(await entityReferenceTest.$save()).toEqual(true);
|
|
42
|
+
refGuid = entityReferenceTest.guid;
|
|
43
|
+
testEntity.reference = entityReferenceTest;
|
|
44
|
+
testEntity.refArray = [entityReferenceTest];
|
|
45
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
46
|
+
entityReferenceTest.test = 'good';
|
|
47
|
+
expect(await entityReferenceTest.$save()).toEqual(true);
|
|
48
|
+
testEntity = nymph.driver.getEntitySync({ class: testArtifacts_1.TestModel }, testGuid);
|
|
49
|
+
expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
|
|
50
|
+
expect(testEntity.guid).toEqual(testGuid);
|
|
51
|
+
testEntity = (await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
|
|
52
|
+
expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
|
|
53
|
+
expect(testEntity.guid).toEqual(testGuid);
|
|
65
54
|
}
|
|
66
|
-
function createMultipleTestEntities() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
yield new Promise((res) => setTimeout(() => res(1), 5));
|
|
77
|
-
}
|
|
55
|
+
async function createMultipleTestEntities() {
|
|
56
|
+
if (!createdMultiple) {
|
|
57
|
+
createdMultiple = true;
|
|
58
|
+
for (let i = 0; i < 100; i++) {
|
|
59
|
+
const testEntity = await testArtifacts_1.TestModel.factory();
|
|
60
|
+
testEntity.name = `Multi Test ${i}`;
|
|
61
|
+
testEntity.$removeTag('test');
|
|
62
|
+
testEntity.$addTag('multiTest');
|
|
63
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
64
|
+
await new Promise((res) => setTimeout(() => res(1), 5));
|
|
78
65
|
}
|
|
79
|
-
}
|
|
66
|
+
}
|
|
80
67
|
}
|
|
81
|
-
it('delete old test data', () =>
|
|
82
|
-
let all =
|
|
68
|
+
it('delete old test data', async () => {
|
|
69
|
+
let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
83
70
|
expect(Array.isArray(all)).toEqual(true);
|
|
84
71
|
for (const cur of all) {
|
|
85
|
-
expect(
|
|
72
|
+
expect(await cur.$delete()).toEqual(true);
|
|
86
73
|
}
|
|
87
|
-
all =
|
|
74
|
+
all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
88
75
|
expect(all.length).toEqual(0);
|
|
89
|
-
})
|
|
90
|
-
it('create entity', () =>
|
|
91
|
-
|
|
92
|
-
})
|
|
93
|
-
it('update mdate on save', () =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
yield testEntity.$save();
|
|
76
|
+
});
|
|
77
|
+
it('create entity', async () => {
|
|
78
|
+
await createTestEntities();
|
|
79
|
+
});
|
|
80
|
+
it('update mdate on save', async () => {
|
|
81
|
+
await createTestEntities();
|
|
82
|
+
const oldMdate = testEntity.mdate ?? Infinity;
|
|
83
|
+
await new Promise((resolve) => setTimeout(() => resolve(true), 100));
|
|
84
|
+
await testEntity.$save();
|
|
99
85
|
expect(testEntity.mdate).toBeGreaterThan(oldMdate);
|
|
100
|
-
})
|
|
101
|
-
it('create multiple entities', () =>
|
|
86
|
+
});
|
|
87
|
+
it('create multiple entities', async () => {
|
|
102
88
|
return createMultipleTestEntities();
|
|
103
|
-
})
|
|
104
|
-
it('by guid', () =>
|
|
105
|
-
|
|
106
|
-
let resultEntity =
|
|
89
|
+
});
|
|
90
|
+
it('by guid', async () => {
|
|
91
|
+
await createTestEntities();
|
|
92
|
+
let resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
|
|
107
93
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
108
|
-
resultEntity =
|
|
94
|
+
resultEntity = await testArtifacts_1.TestModel.factory(testGuid);
|
|
109
95
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
110
|
-
resultEntity =
|
|
96
|
+
resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, (0, guid_1.guid)());
|
|
111
97
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
112
|
-
})
|
|
113
|
-
it('transactions', () =>
|
|
114
|
-
|
|
115
|
-
expect(
|
|
116
|
-
let transaction =
|
|
98
|
+
});
|
|
99
|
+
it('transactions', async () => {
|
|
100
|
+
await createTestEntities();
|
|
101
|
+
expect(await nymph.inTransaction()).toEqual(false);
|
|
102
|
+
let transaction = await nymph.startTransaction('test');
|
|
117
103
|
testEntity.$nymph = transaction;
|
|
118
|
-
if (!(
|
|
104
|
+
if (!(await transaction.inTransaction())) {
|
|
119
105
|
console.log('This Nymph driver or database seems to not support transactions. Skipping transaction tests.');
|
|
120
|
-
|
|
106
|
+
await transaction.rollback('test');
|
|
121
107
|
return;
|
|
122
108
|
}
|
|
123
109
|
testEntity.string = 'bad value';
|
|
124
|
-
expect(
|
|
125
|
-
|
|
126
|
-
expect(
|
|
127
|
-
|
|
110
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
111
|
+
await transaction.rollback('test');
|
|
112
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
113
|
+
await testEntity.$refresh();
|
|
128
114
|
expect(testEntity.string).toEqual('test');
|
|
129
|
-
transaction =
|
|
115
|
+
transaction = await nymph.startTransaction('test');
|
|
130
116
|
testEntity.$nymph = transaction;
|
|
131
|
-
expect(
|
|
132
|
-
expect(
|
|
133
|
-
const resultEntity =
|
|
117
|
+
expect(await transaction.inTransaction()).toEqual(true);
|
|
118
|
+
expect(await testEntity.$delete()).toEqual(true);
|
|
119
|
+
const resultEntity = await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
|
|
134
120
|
expect(resultEntity).toBeNull();
|
|
135
|
-
|
|
136
|
-
expect(
|
|
137
|
-
testEntity = (
|
|
121
|
+
await transaction.rollback('test');
|
|
122
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
123
|
+
testEntity = (await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
|
|
138
124
|
expect(testEntity.guid).toEqual(testGuid);
|
|
139
|
-
transaction =
|
|
125
|
+
transaction = await nymph.startTransaction('test');
|
|
140
126
|
testEntity.$nymph = transaction;
|
|
141
|
-
expect(
|
|
127
|
+
expect(await transaction.inTransaction()).toEqual(true);
|
|
142
128
|
testEntity.string = 'fish';
|
|
143
|
-
expect(
|
|
144
|
-
|
|
129
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
130
|
+
await transaction.commit('test');
|
|
145
131
|
testEntity.$nymph = nymph;
|
|
146
|
-
expect(
|
|
147
|
-
|
|
132
|
+
expect(await transaction.inTransaction()).toEqual(false);
|
|
133
|
+
await testEntity.$refresh();
|
|
148
134
|
expect(testEntity.string).toEqual('fish');
|
|
149
135
|
testEntity.string = 'test';
|
|
150
|
-
expect(
|
|
151
|
-
})
|
|
152
|
-
it('options', () =>
|
|
153
|
-
|
|
154
|
-
const resultEntities =
|
|
136
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
137
|
+
});
|
|
138
|
+
it('options', async () => {
|
|
139
|
+
await createTestEntities();
|
|
140
|
+
const resultEntities = await nymph.getEntities({
|
|
155
141
|
class: testArtifacts_1.TestModel,
|
|
156
142
|
reverse: true,
|
|
157
143
|
offset: 1,
|
|
@@ -160,177 +146,177 @@ This one's zip code is 92064.`;
|
|
|
160
146
|
}, { type: '&', tag: 'test' });
|
|
161
147
|
expect(resultEntities.length).toEqual(1);
|
|
162
148
|
expect(testEntity.$is(resultEntities[0])).toEqual(true);
|
|
163
|
-
})
|
|
164
|
-
it('guid and tags', () =>
|
|
165
|
-
|
|
166
|
-
const resultEntity =
|
|
149
|
+
});
|
|
150
|
+
it('guid and tags', async () => {
|
|
151
|
+
await createTestEntities();
|
|
152
|
+
const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: 'test' });
|
|
167
153
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
168
|
-
})
|
|
169
|
-
it('or selector', () =>
|
|
170
|
-
|
|
171
|
-
const resultEntity =
|
|
154
|
+
});
|
|
155
|
+
it('or selector', async () => {
|
|
156
|
+
await createTestEntities();
|
|
157
|
+
const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [testGuid, (0, guid_1.guid)()] });
|
|
172
158
|
expect(testEntity.$is(resultEntity)).toEqual(true);
|
|
173
|
-
})
|
|
174
|
-
it('wrong or selector', () =>
|
|
175
|
-
|
|
176
|
-
const resultEntity =
|
|
159
|
+
});
|
|
160
|
+
it('wrong or selector', async () => {
|
|
161
|
+
await createTestEntities();
|
|
162
|
+
const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [(0, guid_1.guid)(), (0, guid_1.guid)()] });
|
|
177
163
|
expect(testEntity.$is(resultEntity)).toEqual(false);
|
|
178
|
-
})
|
|
179
|
-
it('not guid', () =>
|
|
180
|
-
|
|
181
|
-
const resultEntity =
|
|
164
|
+
});
|
|
165
|
+
it('not guid', async () => {
|
|
166
|
+
await createTestEntities();
|
|
167
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', '!guid': (0, guid_1.guid)(), tag: 'test' });
|
|
182
168
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
183
|
-
})
|
|
184
|
-
it('not tags', () =>
|
|
185
|
-
|
|
186
|
-
const resultEntity =
|
|
169
|
+
});
|
|
170
|
+
it('not tags', async () => {
|
|
171
|
+
await createTestEntities();
|
|
172
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
|
|
187
173
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
188
|
-
})
|
|
189
|
-
it('guid and wrong tags', () =>
|
|
190
|
-
|
|
191
|
-
const resultEntity =
|
|
174
|
+
});
|
|
175
|
+
it('guid and wrong tags', async () => {
|
|
176
|
+
await createTestEntities();
|
|
177
|
+
const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
|
|
192
178
|
expect(resultEntity).toBeNull();
|
|
193
|
-
})
|
|
194
|
-
it('tags', () =>
|
|
195
|
-
|
|
196
|
-
const resultEntity =
|
|
179
|
+
});
|
|
180
|
+
it('tags', async () => {
|
|
181
|
+
await createTestEntities();
|
|
182
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' });
|
|
197
183
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
198
|
-
})
|
|
199
|
-
it('wrong tags', () =>
|
|
200
|
-
|
|
201
|
-
const resultEntity =
|
|
184
|
+
});
|
|
185
|
+
it('wrong tags', async () => {
|
|
186
|
+
await createTestEntities();
|
|
187
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' });
|
|
202
188
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
203
|
-
})
|
|
204
|
-
it('inclusive tags', () =>
|
|
205
|
-
|
|
206
|
-
const resultEntity =
|
|
189
|
+
});
|
|
190
|
+
it('inclusive tags', async () => {
|
|
191
|
+
await createTestEntities();
|
|
192
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
|
|
207
193
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
208
|
-
})
|
|
209
|
-
it('wrong inclusive tags', () =>
|
|
210
|
-
|
|
211
|
-
const resultEntity =
|
|
194
|
+
});
|
|
195
|
+
it('wrong inclusive tags', async () => {
|
|
196
|
+
await createTestEntities();
|
|
197
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
|
|
212
198
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
213
|
-
})
|
|
214
|
-
it('mixed tags', () =>
|
|
215
|
-
|
|
216
|
-
const resultEntity =
|
|
199
|
+
});
|
|
200
|
+
it('mixed tags', async () => {
|
|
201
|
+
await createTestEntities();
|
|
202
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
|
|
217
203
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
218
|
-
})
|
|
219
|
-
it('wrong inclusive mixed tags', () =>
|
|
220
|
-
|
|
221
|
-
const resultEntity =
|
|
204
|
+
});
|
|
205
|
+
it('wrong inclusive mixed tags', async () => {
|
|
206
|
+
await createTestEntities();
|
|
207
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
|
|
222
208
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
223
|
-
})
|
|
224
|
-
it('wrong exclusive mixed tags', () =>
|
|
225
|
-
|
|
226
|
-
const resultEntity =
|
|
209
|
+
});
|
|
210
|
+
it('wrong exclusive mixed tags', async () => {
|
|
211
|
+
await createTestEntities();
|
|
212
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
|
|
227
213
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
228
|
-
})
|
|
229
|
-
it('defined', () =>
|
|
230
|
-
|
|
231
|
-
const resultEntity =
|
|
214
|
+
});
|
|
215
|
+
it('defined', async () => {
|
|
216
|
+
await createTestEntities();
|
|
217
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', defined: 'string' });
|
|
232
218
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
233
|
-
})
|
|
234
|
-
it('not defined', () =>
|
|
235
|
-
|
|
236
|
-
const resultEntity =
|
|
219
|
+
});
|
|
220
|
+
it('not defined', async () => {
|
|
221
|
+
await createTestEntities();
|
|
222
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
|
|
237
223
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
238
|
-
})
|
|
239
|
-
it('defined in a not and clause', () =>
|
|
240
|
-
|
|
241
|
-
const resultEntity =
|
|
224
|
+
});
|
|
225
|
+
it('defined in a not and clause', async () => {
|
|
226
|
+
await createTestEntities();
|
|
227
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
|
|
242
228
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
243
|
-
})
|
|
244
|
-
it('equal', () =>
|
|
245
|
-
|
|
246
|
-
const resultEntity =
|
|
229
|
+
});
|
|
230
|
+
it('equal', async () => {
|
|
231
|
+
await createTestEntities();
|
|
232
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', equal: ['string', 'test'] });
|
|
247
233
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
248
|
-
})
|
|
249
|
-
it('not equal', () =>
|
|
250
|
-
|
|
251
|
-
const referenceEntity =
|
|
234
|
+
});
|
|
235
|
+
it('not equal', async () => {
|
|
236
|
+
await createTestEntities();
|
|
237
|
+
const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
|
|
252
238
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
253
|
-
const resultEntity =
|
|
239
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
|
|
254
240
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
255
241
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
256
|
-
})
|
|
257
|
-
it('like', () =>
|
|
258
|
-
|
|
259
|
-
const resultEntity =
|
|
242
|
+
});
|
|
243
|
+
it('like', async () => {
|
|
244
|
+
await createTestEntities();
|
|
245
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 't_s%'] });
|
|
260
246
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
261
|
-
})
|
|
262
|
-
it('not like', () =>
|
|
263
|
-
|
|
264
|
-
const referenceEntity =
|
|
247
|
+
});
|
|
248
|
+
it('not like', async () => {
|
|
249
|
+
await createTestEntities();
|
|
250
|
+
const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
|
|
265
251
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
266
|
-
const resultEntity =
|
|
252
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
|
|
267
253
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
268
254
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
269
|
-
})
|
|
270
|
-
it('ilike', () =>
|
|
271
|
-
|
|
272
|
-
const resultEntity =
|
|
255
|
+
});
|
|
256
|
+
it('ilike', async () => {
|
|
257
|
+
await createTestEntities();
|
|
258
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
|
|
273
259
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
274
|
-
})
|
|
275
|
-
it('not ilike', () =>
|
|
276
|
-
|
|
277
|
-
const referenceEntity =
|
|
260
|
+
});
|
|
261
|
+
it('not ilike', async () => {
|
|
262
|
+
await createTestEntities();
|
|
263
|
+
const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
|
|
278
264
|
expect(referenceEntity.guid).toEqual(refGuid);
|
|
279
|
-
const resultEntity =
|
|
265
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
|
|
280
266
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
281
267
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
282
|
-
})
|
|
283
|
-
it('like with wrong case', () =>
|
|
284
|
-
|
|
285
|
-
const resultEntity =
|
|
268
|
+
});
|
|
269
|
+
it('like with wrong case', async () => {
|
|
270
|
+
await createTestEntities();
|
|
271
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 'T_s%'] });
|
|
286
272
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
287
|
-
})
|
|
288
|
-
it('tags and equal', () =>
|
|
289
|
-
|
|
290
|
-
const resultEntity =
|
|
273
|
+
});
|
|
274
|
+
it('tags and equal', async () => {
|
|
275
|
+
await createTestEntities();
|
|
276
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
|
|
291
277
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
292
|
-
})
|
|
293
|
-
it('wrong tags right equal', () =>
|
|
294
|
-
|
|
295
|
-
const resultEntity =
|
|
278
|
+
});
|
|
279
|
+
it('wrong tags right equal', async () => {
|
|
280
|
+
await createTestEntities();
|
|
281
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
|
|
296
282
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
297
|
-
})
|
|
298
|
-
it('right tags wrong equal', () =>
|
|
299
|
-
|
|
300
|
-
const resultEntity =
|
|
283
|
+
});
|
|
284
|
+
it('right tags wrong equal', async () => {
|
|
285
|
+
await createTestEntities();
|
|
286
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
|
|
301
287
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
302
|
-
})
|
|
303
|
-
it('wrong tags wrong equal', () =>
|
|
304
|
-
|
|
305
|
-
const resultEntity =
|
|
288
|
+
});
|
|
289
|
+
it('wrong tags wrong equal', async () => {
|
|
290
|
+
await createTestEntities();
|
|
291
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
|
|
306
292
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
307
|
-
})
|
|
308
|
-
it('contain', () =>
|
|
309
|
-
|
|
310
|
-
let resultEntity =
|
|
293
|
+
});
|
|
294
|
+
it('contain', async () => {
|
|
295
|
+
await createTestEntities();
|
|
296
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'values'] });
|
|
311
297
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
312
|
-
resultEntity =
|
|
298
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'test'] });
|
|
313
299
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
314
|
-
})
|
|
315
|
-
it('not contain', () =>
|
|
316
|
-
|
|
317
|
-
const resultEntity =
|
|
300
|
+
});
|
|
301
|
+
it('not contain', async () => {
|
|
302
|
+
await createTestEntities();
|
|
303
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
|
|
318
304
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
319
|
-
})
|
|
320
|
-
it('wrong contain', () =>
|
|
321
|
-
|
|
322
|
-
let resultEntity =
|
|
305
|
+
});
|
|
306
|
+
it('wrong contain', async () => {
|
|
307
|
+
await createTestEntities();
|
|
308
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'pickles'] });
|
|
323
309
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
324
|
-
resultEntity =
|
|
310
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'pickles'] });
|
|
325
311
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
326
|
-
})
|
|
327
|
-
it('match', () =>
|
|
328
|
-
|
|
329
|
-
let resultEntity =
|
|
312
|
+
});
|
|
313
|
+
it('match', async () => {
|
|
314
|
+
await createTestEntities();
|
|
315
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', '.*'] });
|
|
330
316
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
331
|
-
resultEntity =
|
|
317
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
|
|
332
318
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
333
|
-
resultEntity =
|
|
319
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, {
|
|
334
320
|
type: '|',
|
|
335
321
|
match: [
|
|
336
322
|
['string', '[0-9]'],
|
|
@@ -338,31 +324,31 @@ This one's zip code is 92064.`;
|
|
|
338
324
|
],
|
|
339
325
|
});
|
|
340
326
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
341
|
-
resultEntity =
|
|
327
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
342
328
|
type: '&',
|
|
343
329
|
tag: 'test',
|
|
344
330
|
match: ['match', '[-a-zA-Z0-9+_]+@[-a-zA-Z0-9_]+.[-a-zA-Z0-9_]{2,4}'],
|
|
345
331
|
});
|
|
346
332
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
347
|
-
resultEntity =
|
|
333
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
348
334
|
type: '&',
|
|
349
335
|
tag: 'test',
|
|
350
336
|
match: ['match', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'],
|
|
351
337
|
});
|
|
352
338
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
353
|
-
})
|
|
354
|
-
it('imatch', () =>
|
|
355
|
-
|
|
356
|
-
const resultEntity =
|
|
339
|
+
});
|
|
340
|
+
it('imatch', async () => {
|
|
341
|
+
await createTestEntities();
|
|
342
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
|
|
357
343
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
358
|
-
})
|
|
359
|
-
it('wrong match', () =>
|
|
360
|
-
|
|
361
|
-
let resultEntity =
|
|
344
|
+
});
|
|
345
|
+
it('wrong match', async () => {
|
|
346
|
+
await createTestEntities();
|
|
347
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', 'Q'] });
|
|
362
348
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
363
|
-
resultEntity =
|
|
349
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
|
|
364
350
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
365
|
-
resultEntity =
|
|
351
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
366
352
|
type: '|',
|
|
367
353
|
match: [
|
|
368
354
|
['string', '[0-9]'],
|
|
@@ -370,20 +356,20 @@ This one's zip code is 92064.`;
|
|
|
370
356
|
],
|
|
371
357
|
});
|
|
372
358
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
373
|
-
})
|
|
374
|
-
it('match wrong case', () =>
|
|
375
|
-
|
|
376
|
-
const resultEntity =
|
|
359
|
+
});
|
|
360
|
+
it('match wrong case', async () => {
|
|
361
|
+
await createTestEntities();
|
|
362
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
|
|
377
363
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
378
|
-
})
|
|
379
|
-
it('match and equal inclusive', () =>
|
|
380
|
-
|
|
381
|
-
const resultEntity =
|
|
364
|
+
});
|
|
365
|
+
it('match and equal inclusive', async () => {
|
|
366
|
+
await createTestEntities();
|
|
367
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
|
|
382
368
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
383
|
-
})
|
|
384
|
-
it('greater than', () =>
|
|
385
|
-
|
|
386
|
-
let resultEntity =
|
|
369
|
+
});
|
|
370
|
+
it('greater than', async () => {
|
|
371
|
+
await createTestEntities();
|
|
372
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
387
373
|
type: '|',
|
|
388
374
|
gt: [
|
|
389
375
|
['number', 30],
|
|
@@ -391,7 +377,7 @@ This one's zip code is 92064.`;
|
|
|
391
377
|
],
|
|
392
378
|
});
|
|
393
379
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
394
|
-
resultEntity =
|
|
380
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
395
381
|
type: '|',
|
|
396
382
|
gt: [
|
|
397
383
|
['number', 31],
|
|
@@ -399,7 +385,7 @@ This one's zip code is 92064.`;
|
|
|
399
385
|
],
|
|
400
386
|
});
|
|
401
387
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
402
|
-
resultEntity =
|
|
388
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
403
389
|
type: '|',
|
|
404
390
|
gt: [
|
|
405
391
|
['number', 29],
|
|
@@ -407,7 +393,7 @@ This one's zip code is 92064.`;
|
|
|
407
393
|
],
|
|
408
394
|
});
|
|
409
395
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
410
|
-
resultEntity =
|
|
396
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
411
397
|
type: '|',
|
|
412
398
|
gt: [
|
|
413
399
|
['numberString', 30],
|
|
@@ -415,7 +401,7 @@ This one's zip code is 92064.`;
|
|
|
415
401
|
],
|
|
416
402
|
});
|
|
417
403
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
418
|
-
resultEntity =
|
|
404
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
419
405
|
type: '|',
|
|
420
406
|
gt: [
|
|
421
407
|
['numberString', 31],
|
|
@@ -423,7 +409,7 @@ This one's zip code is 92064.`;
|
|
|
423
409
|
],
|
|
424
410
|
});
|
|
425
411
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
426
|
-
resultEntity =
|
|
412
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
427
413
|
type: '|',
|
|
428
414
|
gt: [
|
|
429
415
|
['numberString', 29],
|
|
@@ -431,10 +417,10 @@ This one's zip code is 92064.`;
|
|
|
431
417
|
],
|
|
432
418
|
});
|
|
433
419
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
434
|
-
})
|
|
435
|
-
it('greater than or equal', () =>
|
|
436
|
-
|
|
437
|
-
let resultEntity =
|
|
420
|
+
});
|
|
421
|
+
it('greater than or equal', async () => {
|
|
422
|
+
await createTestEntities();
|
|
423
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
438
424
|
type: '|',
|
|
439
425
|
gte: [
|
|
440
426
|
['number', 30],
|
|
@@ -442,7 +428,7 @@ This one's zip code is 92064.`;
|
|
|
442
428
|
],
|
|
443
429
|
});
|
|
444
430
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
445
|
-
resultEntity =
|
|
431
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
446
432
|
type: '|',
|
|
447
433
|
gte: [
|
|
448
434
|
['number', 31],
|
|
@@ -450,7 +436,7 @@ This one's zip code is 92064.`;
|
|
|
450
436
|
],
|
|
451
437
|
});
|
|
452
438
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
453
|
-
resultEntity =
|
|
439
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
454
440
|
type: '|',
|
|
455
441
|
gte: [
|
|
456
442
|
['number', 29],
|
|
@@ -458,7 +444,7 @@ This one's zip code is 92064.`;
|
|
|
458
444
|
],
|
|
459
445
|
});
|
|
460
446
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
461
|
-
resultEntity =
|
|
447
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
462
448
|
type: '|',
|
|
463
449
|
gte: [
|
|
464
450
|
['numberString', 30],
|
|
@@ -466,7 +452,7 @@ This one's zip code is 92064.`;
|
|
|
466
452
|
],
|
|
467
453
|
});
|
|
468
454
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
469
|
-
resultEntity =
|
|
455
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
470
456
|
type: '|',
|
|
471
457
|
gte: [
|
|
472
458
|
['numberString', 31],
|
|
@@ -474,7 +460,7 @@ This one's zip code is 92064.`;
|
|
|
474
460
|
],
|
|
475
461
|
});
|
|
476
462
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
477
|
-
resultEntity =
|
|
463
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
478
464
|
type: '|',
|
|
479
465
|
gte: [
|
|
480
466
|
['numberString', 29],
|
|
@@ -482,10 +468,10 @@ This one's zip code is 92064.`;
|
|
|
482
468
|
],
|
|
483
469
|
});
|
|
484
470
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
485
|
-
})
|
|
486
|
-
it('less than', () =>
|
|
487
|
-
|
|
488
|
-
let resultEntity =
|
|
471
|
+
});
|
|
472
|
+
it('less than', async () => {
|
|
473
|
+
await createTestEntities();
|
|
474
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
489
475
|
type: '|',
|
|
490
476
|
lt: [
|
|
491
477
|
['number', 30],
|
|
@@ -493,7 +479,7 @@ This one's zip code is 92064.`;
|
|
|
493
479
|
],
|
|
494
480
|
});
|
|
495
481
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
496
|
-
resultEntity =
|
|
482
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
497
483
|
type: '|',
|
|
498
484
|
lt: [
|
|
499
485
|
['number', 31],
|
|
@@ -501,7 +487,7 @@ This one's zip code is 92064.`;
|
|
|
501
487
|
],
|
|
502
488
|
});
|
|
503
489
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
504
|
-
resultEntity =
|
|
490
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
505
491
|
type: '|',
|
|
506
492
|
lt: [
|
|
507
493
|
['number', 29],
|
|
@@ -509,7 +495,7 @@ This one's zip code is 92064.`;
|
|
|
509
495
|
],
|
|
510
496
|
});
|
|
511
497
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
512
|
-
resultEntity =
|
|
498
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
513
499
|
type: '|',
|
|
514
500
|
lt: [
|
|
515
501
|
['numberString', 30],
|
|
@@ -517,7 +503,7 @@ This one's zip code is 92064.`;
|
|
|
517
503
|
],
|
|
518
504
|
});
|
|
519
505
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
520
|
-
resultEntity =
|
|
506
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
521
507
|
type: '|',
|
|
522
508
|
lt: [
|
|
523
509
|
['numberString', 31],
|
|
@@ -525,7 +511,7 @@ This one's zip code is 92064.`;
|
|
|
525
511
|
],
|
|
526
512
|
});
|
|
527
513
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
528
|
-
resultEntity =
|
|
514
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
529
515
|
type: '|',
|
|
530
516
|
lt: [
|
|
531
517
|
['numberString', 29],
|
|
@@ -533,10 +519,10 @@ This one's zip code is 92064.`;
|
|
|
533
519
|
],
|
|
534
520
|
});
|
|
535
521
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
536
|
-
})
|
|
537
|
-
it('less than or equal', () =>
|
|
538
|
-
|
|
539
|
-
let resultEntity =
|
|
522
|
+
});
|
|
523
|
+
it('less than or equal', async () => {
|
|
524
|
+
await createTestEntities();
|
|
525
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
540
526
|
type: '|',
|
|
541
527
|
lte: [
|
|
542
528
|
['number', 30],
|
|
@@ -544,7 +530,7 @@ This one's zip code is 92064.`;
|
|
|
544
530
|
],
|
|
545
531
|
});
|
|
546
532
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
547
|
-
resultEntity =
|
|
533
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
548
534
|
type: '|',
|
|
549
535
|
lte: [
|
|
550
536
|
['number', 31],
|
|
@@ -552,7 +538,7 @@ This one's zip code is 92064.`;
|
|
|
552
538
|
],
|
|
553
539
|
});
|
|
554
540
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
555
|
-
resultEntity =
|
|
541
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
556
542
|
type: '|',
|
|
557
543
|
lte: [
|
|
558
544
|
['number', 29],
|
|
@@ -560,7 +546,7 @@ This one's zip code is 92064.`;
|
|
|
560
546
|
],
|
|
561
547
|
});
|
|
562
548
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
563
|
-
resultEntity =
|
|
549
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
564
550
|
type: '|',
|
|
565
551
|
lte: [
|
|
566
552
|
['numberString', 30],
|
|
@@ -568,7 +554,7 @@ This one's zip code is 92064.`;
|
|
|
568
554
|
],
|
|
569
555
|
});
|
|
570
556
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
571
|
-
resultEntity =
|
|
557
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
572
558
|
type: '|',
|
|
573
559
|
lte: [
|
|
574
560
|
['numberString', 31],
|
|
@@ -576,7 +562,7 @@ This one's zip code is 92064.`;
|
|
|
576
562
|
],
|
|
577
563
|
});
|
|
578
564
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
579
|
-
resultEntity =
|
|
565
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
580
566
|
type: '|',
|
|
581
567
|
lte: [
|
|
582
568
|
['numberString', 29],
|
|
@@ -584,36 +570,34 @@ This one's zip code is 92064.`;
|
|
|
584
570
|
],
|
|
585
571
|
});
|
|
586
572
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
587
|
-
})
|
|
588
|
-
it('not inequality', () =>
|
|
589
|
-
|
|
590
|
-
const resultEntity =
|
|
573
|
+
});
|
|
574
|
+
it('not inequality', async () => {
|
|
575
|
+
await createTestEntities();
|
|
576
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
|
|
591
577
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
592
|
-
})
|
|
593
|
-
it('wrong inequality', () =>
|
|
594
|
-
|
|
595
|
-
const resultEntity =
|
|
578
|
+
});
|
|
579
|
+
it('wrong inequality', async () => {
|
|
580
|
+
await createTestEntities();
|
|
581
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', lte: ['number', 29.99] });
|
|
596
582
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
597
|
-
})
|
|
598
|
-
it('greater than cdate', () =>
|
|
599
|
-
|
|
600
|
-
|
|
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] });
|
|
583
|
+
});
|
|
584
|
+
it('greater than cdate', async () => {
|
|
585
|
+
await createTestEntities();
|
|
586
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] });
|
|
602
587
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
603
|
-
})
|
|
604
|
-
it('wrong cdate', () =>
|
|
605
|
-
|
|
606
|
-
|
|
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] });
|
|
588
|
+
});
|
|
589
|
+
it('wrong cdate', async () => {
|
|
590
|
+
await createTestEntities();
|
|
591
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] });
|
|
608
592
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
609
|
-
})
|
|
610
|
-
it('time selector', () =>
|
|
611
|
-
|
|
612
|
-
const referenceEntity =
|
|
613
|
-
let resultEntity =
|
|
593
|
+
});
|
|
594
|
+
it('time selector', async () => {
|
|
595
|
+
await createTestEntities();
|
|
596
|
+
const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
|
|
597
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-1 day'] });
|
|
614
598
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
615
599
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
616
|
-
resultEntity =
|
|
600
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
617
601
|
type: '|',
|
|
618
602
|
gt: [
|
|
619
603
|
['timestamp', null, '-1 day'],
|
|
@@ -622,55 +606,54 @@ This one's zip code is 92064.`;
|
|
|
622
606
|
});
|
|
623
607
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
624
608
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
625
|
-
resultEntity =
|
|
609
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
|
|
626
610
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
627
611
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
628
|
-
resultEntity =
|
|
612
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
|
|
629
613
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
630
614
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
|
|
631
|
-
})
|
|
632
|
-
it('wrong time selector', () =>
|
|
633
|
-
|
|
634
|
-
const referenceEntity =
|
|
635
|
-
let resultEntity =
|
|
615
|
+
});
|
|
616
|
+
it('wrong time selector', async () => {
|
|
617
|
+
await createTestEntities();
|
|
618
|
+
const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
|
|
619
|
+
let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] });
|
|
636
620
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
637
621
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
638
|
-
resultEntity =
|
|
622
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
|
|
639
623
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
640
624
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
641
|
-
resultEntity =
|
|
625
|
+
resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
|
|
642
626
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
643
627
|
expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
|
|
644
|
-
})
|
|
645
|
-
it('references', () =>
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
expect(
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
const resultEntity = yield nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
|
|
628
|
+
});
|
|
629
|
+
it('references', async () => {
|
|
630
|
+
await createTestEntities();
|
|
631
|
+
expect(testEntity.reference?.test).toEqual('good');
|
|
632
|
+
expect(testEntity.refArray?.[0].test).toEqual('good');
|
|
633
|
+
});
|
|
634
|
+
it('ref', async () => {
|
|
635
|
+
await createTestEntities();
|
|
636
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
|
|
654
637
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
655
|
-
})
|
|
656
|
-
it('not ref', () =>
|
|
657
|
-
|
|
658
|
-
const resultEntity =
|
|
638
|
+
});
|
|
639
|
+
it('not ref', async () => {
|
|
640
|
+
await createTestEntities();
|
|
641
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', (0, guid_1.guid)()] });
|
|
659
642
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
660
|
-
})
|
|
661
|
-
it('wrong ref', () =>
|
|
662
|
-
|
|
663
|
-
const resultEntity =
|
|
643
|
+
});
|
|
644
|
+
it('wrong ref', async () => {
|
|
645
|
+
await createTestEntities();
|
|
646
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
|
|
664
647
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
665
|
-
})
|
|
666
|
-
it('nonexistent ref', () =>
|
|
667
|
-
|
|
668
|
-
const resultEntity =
|
|
648
|
+
});
|
|
649
|
+
it('nonexistent ref', async () => {
|
|
650
|
+
await createTestEntities();
|
|
651
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['pickle', refGuid] });
|
|
669
652
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
670
|
-
})
|
|
671
|
-
it('inclusive ref', () =>
|
|
672
|
-
|
|
673
|
-
const resultEntity =
|
|
653
|
+
});
|
|
654
|
+
it('inclusive ref', async () => {
|
|
655
|
+
await createTestEntities();
|
|
656
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
674
657
|
type: '|',
|
|
675
658
|
ref: [
|
|
676
659
|
['reference', refGuid],
|
|
@@ -678,10 +661,10 @@ This one's zip code is 92064.`;
|
|
|
678
661
|
],
|
|
679
662
|
});
|
|
680
663
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
681
|
-
})
|
|
682
|
-
it('wrong inclusive ref', () =>
|
|
683
|
-
|
|
684
|
-
const resultEntity =
|
|
664
|
+
});
|
|
665
|
+
it('wrong inclusive ref', async () => {
|
|
666
|
+
await createTestEntities();
|
|
667
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
685
668
|
type: '|',
|
|
686
669
|
ref: [
|
|
687
670
|
['reference', (0, guid_1.guid)()],
|
|
@@ -689,15 +672,15 @@ This one's zip code is 92064.`;
|
|
|
689
672
|
],
|
|
690
673
|
});
|
|
691
674
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
692
|
-
})
|
|
693
|
-
it('ref in an array', () =>
|
|
694
|
-
|
|
695
|
-
const resultEntity =
|
|
675
|
+
});
|
|
676
|
+
it('ref in an array', async () => {
|
|
677
|
+
await createTestEntities();
|
|
678
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['refArray', refGuid] });
|
|
696
679
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
697
|
-
})
|
|
698
|
-
it('wrong ref in an array', () =>
|
|
699
|
-
|
|
700
|
-
const resultEntity =
|
|
680
|
+
});
|
|
681
|
+
it('wrong ref in an array', async () => {
|
|
682
|
+
await createTestEntities();
|
|
683
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
701
684
|
type: '&',
|
|
702
685
|
ref: [
|
|
703
686
|
['refArray', refGuid],
|
|
@@ -705,10 +688,10 @@ This one's zip code is 92064.`;
|
|
|
705
688
|
],
|
|
706
689
|
});
|
|
707
690
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
708
|
-
})
|
|
709
|
-
it('logic operations', () =>
|
|
710
|
-
|
|
711
|
-
const resultEntity =
|
|
691
|
+
});
|
|
692
|
+
it('logic operations', async () => {
|
|
693
|
+
await createTestEntities();
|
|
694
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
712
695
|
type: '&',
|
|
713
696
|
'!ref': [
|
|
714
697
|
['refArray', (0, guid_1.guid)()],
|
|
@@ -741,38 +724,37 @@ This one's zip code is 92064.`;
|
|
|
741
724
|
],
|
|
742
725
|
});
|
|
743
726
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
744
|
-
})
|
|
745
|
-
it('count return', () =>
|
|
746
|
-
|
|
747
|
-
const result =
|
|
748
|
-
const resultCount =
|
|
727
|
+
});
|
|
728
|
+
it('count return', async () => {
|
|
729
|
+
await createTestEntities();
|
|
730
|
+
const result = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
731
|
+
const resultCount = await nymph.getEntities({
|
|
749
732
|
class: testArtifacts_1.TestModel,
|
|
750
733
|
return: 'count',
|
|
751
734
|
});
|
|
752
735
|
expect(resultCount).toBeGreaterThanOrEqual(1);
|
|
753
736
|
expect(resultCount).toEqual(result.length);
|
|
754
|
-
const resultSelectors =
|
|
755
|
-
const resultSelectorsCount =
|
|
737
|
+
const resultSelectors = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
|
|
738
|
+
const resultSelectorsCount = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'count' }, { type: '&', ref: ['reference', refGuid] });
|
|
756
739
|
expect(resultSelectorsCount).toBeGreaterThanOrEqual(1);
|
|
757
740
|
expect(resultSelectorsCount).toEqual(resultSelectors.length);
|
|
758
|
-
const resultSelectorsLimit =
|
|
741
|
+
const resultSelectorsLimit = await nymph.getEntities({
|
|
759
742
|
class: testArtifacts_1.TestModel,
|
|
760
743
|
limit: 1,
|
|
761
744
|
return: 'count',
|
|
762
745
|
});
|
|
763
746
|
expect(resultSelectorsLimit).toEqual(1);
|
|
764
|
-
const resultSelectorsSingle =
|
|
747
|
+
const resultSelectorsSingle = await nymph.getEntity({
|
|
765
748
|
class: testArtifacts_1.TestModel,
|
|
766
749
|
return: 'count',
|
|
767
750
|
});
|
|
768
751
|
expect(resultSelectorsSingle).toEqual(1);
|
|
769
|
-
const resultSelectorsEmpty =
|
|
752
|
+
const resultSelectorsEmpty = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'count' }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
|
|
770
753
|
expect(resultSelectorsEmpty).toEqual(0);
|
|
771
|
-
})
|
|
772
|
-
it('guid return', () =>
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
const resultGuid = yield nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'guid' }, {
|
|
754
|
+
});
|
|
755
|
+
it('guid return', async () => {
|
|
756
|
+
await createTestEntities();
|
|
757
|
+
const resultGuid = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'guid' }, {
|
|
776
758
|
type: '&',
|
|
777
759
|
'!ref': [
|
|
778
760
|
['refArray', (0, guid_1.guid)()],
|
|
@@ -804,11 +786,11 @@ This one's zip code is 92064.`;
|
|
|
804
786
|
['array', 500],
|
|
805
787
|
],
|
|
806
788
|
});
|
|
807
|
-
expect(resultGuid.indexOf(
|
|
808
|
-
})
|
|
809
|
-
it('deep selector', () =>
|
|
810
|
-
|
|
811
|
-
const resultEntity =
|
|
789
|
+
expect(resultGuid.indexOf(testEntity.guid ?? '')).toBeGreaterThan(-1);
|
|
790
|
+
});
|
|
791
|
+
it('deep selector', async () => {
|
|
792
|
+
await createTestEntities();
|
|
793
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
812
794
|
type: '&',
|
|
813
795
|
'!ref': [
|
|
814
796
|
['refArray', (0, guid_1.guid)()],
|
|
@@ -848,7 +830,7 @@ This one's zip code is 92064.`;
|
|
|
848
830
|
],
|
|
849
831
|
});
|
|
850
832
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
851
|
-
const resultEntity2 =
|
|
833
|
+
const resultEntity2 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
852
834
|
type: '&',
|
|
853
835
|
'!ref': [
|
|
854
836
|
['refArray', (0, guid_1.guid)()],
|
|
@@ -888,7 +870,7 @@ This one's zip code is 92064.`;
|
|
|
888
870
|
],
|
|
889
871
|
});
|
|
890
872
|
expect(testEntity.$inArray(resultEntity2)).toEqual(true);
|
|
891
|
-
const resultEntity3 =
|
|
873
|
+
const resultEntity3 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
892
874
|
type: '|',
|
|
893
875
|
selector: [
|
|
894
876
|
{
|
|
@@ -900,7 +882,7 @@ This one's zip code is 92064.`;
|
|
|
900
882
|
],
|
|
901
883
|
});
|
|
902
884
|
expect(testEntity.$inArray(resultEntity3)).toEqual(true);
|
|
903
|
-
const resultEntity4 =
|
|
885
|
+
const resultEntity4 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
904
886
|
type: '|',
|
|
905
887
|
selector: [
|
|
906
888
|
{
|
|
@@ -918,9 +900,9 @@ This one's zip code is 92064.`;
|
|
|
918
900
|
],
|
|
919
901
|
});
|
|
920
902
|
expect(testEntity.$inArray(resultEntity4)).toEqual(true);
|
|
921
|
-
})
|
|
922
|
-
it('wrong deep selector', () =>
|
|
923
|
-
const resultEntity =
|
|
903
|
+
});
|
|
904
|
+
it('wrong deep selector', async () => {
|
|
905
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
924
906
|
type: '&',
|
|
925
907
|
selector: [
|
|
926
908
|
{
|
|
@@ -932,10 +914,10 @@ This one's zip code is 92064.`;
|
|
|
932
914
|
],
|
|
933
915
|
});
|
|
934
916
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
935
|
-
})
|
|
936
|
-
it('qref', () =>
|
|
937
|
-
|
|
938
|
-
const resultEntity =
|
|
917
|
+
});
|
|
918
|
+
it('qref', async () => {
|
|
919
|
+
await createTestEntities();
|
|
920
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
939
921
|
type: '&',
|
|
940
922
|
qref: [
|
|
941
923
|
'reference',
|
|
@@ -943,10 +925,10 @@ This one's zip code is 92064.`;
|
|
|
943
925
|
],
|
|
944
926
|
});
|
|
945
927
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
946
|
-
})
|
|
947
|
-
it('not qref', () =>
|
|
948
|
-
|
|
949
|
-
const resultEntity =
|
|
928
|
+
});
|
|
929
|
+
it('not qref', async () => {
|
|
930
|
+
await createTestEntities();
|
|
931
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
950
932
|
type: '&',
|
|
951
933
|
'!qref': [
|
|
952
934
|
'reference',
|
|
@@ -954,10 +936,10 @@ This one's zip code is 92064.`;
|
|
|
954
936
|
],
|
|
955
937
|
});
|
|
956
938
|
expect(testEntity.$inArray(resultEntity)).toEqual(true);
|
|
957
|
-
})
|
|
958
|
-
it('wrong qref class', () =>
|
|
959
|
-
|
|
960
|
-
const resultEntity =
|
|
939
|
+
});
|
|
940
|
+
it('wrong qref class', async () => {
|
|
941
|
+
await createTestEntities();
|
|
942
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
961
943
|
type: '&',
|
|
962
944
|
qref: [
|
|
963
945
|
'reference',
|
|
@@ -965,10 +947,10 @@ This one's zip code is 92064.`;
|
|
|
965
947
|
],
|
|
966
948
|
});
|
|
967
949
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
968
|
-
})
|
|
969
|
-
it('wrong qref data', () =>
|
|
970
|
-
|
|
971
|
-
const resultEntity =
|
|
950
|
+
});
|
|
951
|
+
it('wrong qref data', async () => {
|
|
952
|
+
await createTestEntities();
|
|
953
|
+
const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
|
|
972
954
|
type: '&',
|
|
973
955
|
qref: [
|
|
974
956
|
'reference',
|
|
@@ -976,20 +958,19 @@ This one's zip code is 92064.`;
|
|
|
976
958
|
],
|
|
977
959
|
});
|
|
978
960
|
expect(testEntity.$inArray(resultEntity)).toEqual(false);
|
|
979
|
-
})
|
|
980
|
-
it('sort option', () =>
|
|
981
|
-
|
|
982
|
-
yield createMultipleTestEntities();
|
|
961
|
+
});
|
|
962
|
+
it('sort option', async () => {
|
|
963
|
+
await createMultipleTestEntities();
|
|
983
964
|
for (const sort of ['cdate', 'mdate']) {
|
|
984
|
-
let resultEntities =
|
|
965
|
+
let resultEntities = await nymph.getEntities({
|
|
985
966
|
class: testArtifacts_1.TestModel,
|
|
986
967
|
sort: sort,
|
|
987
968
|
});
|
|
988
969
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
989
970
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
990
|
-
expect(resultEntities[i + 1][sort]).toBeGreaterThan(
|
|
971
|
+
expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
|
|
991
972
|
}
|
|
992
|
-
let resultGuids =
|
|
973
|
+
let resultGuids = await nymph.getEntities({
|
|
993
974
|
class: testArtifacts_1.TestModel,
|
|
994
975
|
sort: sort,
|
|
995
976
|
return: 'guid',
|
|
@@ -998,135 +979,129 @@ This one's zip code is 92064.`;
|
|
|
998
979
|
for (let i = 0; i < resultGuids.length - 1; i++) {
|
|
999
980
|
expect(resultGuids[i]).toEqual(resultEntities[i].guid);
|
|
1000
981
|
}
|
|
1001
|
-
resultEntities =
|
|
982
|
+
resultEntities = await nymph.getEntities({
|
|
1002
983
|
class: testArtifacts_1.TestModel,
|
|
1003
984
|
sort: sort,
|
|
1004
985
|
reverse: true,
|
|
1005
986
|
});
|
|
1006
987
|
expect(resultEntities.length).toBeGreaterThan(100);
|
|
1007
988
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1008
|
-
expect(resultEntities[i + 1][sort]).toBeLessThan(
|
|
989
|
+
expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
|
|
1009
990
|
}
|
|
1010
|
-
resultEntities =
|
|
991
|
+
resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort }, { type: '&', match: ['name', '^Multi Test '] });
|
|
1011
992
|
expect(resultEntities.length).toEqual(100);
|
|
1012
993
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1013
|
-
expect(resultEntities[i + 1][sort]).toBeGreaterThan(
|
|
994
|
+
expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
|
|
1014
995
|
}
|
|
1015
|
-
resultEntities =
|
|
996
|
+
resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
|
|
1016
997
|
expect(resultEntities.length).toEqual(100);
|
|
1017
998
|
for (let i = 0; i < resultEntities.length - 1; i++) {
|
|
1018
|
-
expect(resultEntities[i + 1][sort]).toBeLessThan(
|
|
999
|
+
expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
|
|
1019
1000
|
}
|
|
1020
1001
|
}
|
|
1021
|
-
})
|
|
1022
|
-
it('delete reference', () =>
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
expect(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
expect(yield testEntity.$delete()).toEqual(true);
|
|
1002
|
+
});
|
|
1003
|
+
it('delete reference', async () => {
|
|
1004
|
+
await createTestEntities();
|
|
1005
|
+
expect(await testEntity.reference?.$delete()).toEqual(true);
|
|
1006
|
+
expect(testEntity.reference?.guid).toBeNull();
|
|
1007
|
+
});
|
|
1008
|
+
it('delete', async () => {
|
|
1009
|
+
await createTestEntities();
|
|
1010
|
+
expect(await testEntity.$delete()).toEqual(true);
|
|
1031
1011
|
expect(testEntity.guid).toBeNull();
|
|
1032
|
-
const entity =
|
|
1012
|
+
const entity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid });
|
|
1033
1013
|
expect(entity).toBeNull();
|
|
1034
|
-
})
|
|
1014
|
+
});
|
|
1035
1015
|
}
|
|
1036
1016
|
exports.QueriesTest = QueriesTest;
|
|
1037
1017
|
function UIDTest(nymph, it) {
|
|
1038
1018
|
nymph.addEntityClass(testArtifacts_1.TestModel);
|
|
1039
1019
|
nymph.addEntityClass(testArtifacts_1.TestBModel);
|
|
1040
|
-
it('delete old test data', () =>
|
|
1041
|
-
expect(
|
|
1042
|
-
expect(
|
|
1043
|
-
})
|
|
1044
|
-
it('new UID', () =>
|
|
1045
|
-
expect(
|
|
1046
|
-
})
|
|
1047
|
-
it('increment UID', () =>
|
|
1048
|
-
expect(
|
|
1049
|
-
})
|
|
1050
|
-
it('retrieve UID', () =>
|
|
1051
|
-
expect(
|
|
1052
|
-
})
|
|
1053
|
-
it('rename UID', () =>
|
|
1054
|
-
expect(
|
|
1055
|
-
expect(
|
|
1056
|
-
expect(
|
|
1057
|
-
expect(
|
|
1058
|
-
expect(
|
|
1059
|
-
expect(
|
|
1060
|
-
})
|
|
1061
|
-
it('set UID', () =>
|
|
1062
|
-
expect(
|
|
1063
|
-
expect(
|
|
1064
|
-
})
|
|
1065
|
-
it('delete UID', () =>
|
|
1066
|
-
expect(
|
|
1067
|
-
expect(
|
|
1068
|
-
})
|
|
1020
|
+
it('delete old test data', async () => {
|
|
1021
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1022
|
+
expect(await nymph.deleteUID('NewUID')).toEqual(true);
|
|
1023
|
+
});
|
|
1024
|
+
it('new UID', async () => {
|
|
1025
|
+
expect(await nymph.newUID('TestUID')).toEqual(1);
|
|
1026
|
+
});
|
|
1027
|
+
it('increment UID', async () => {
|
|
1028
|
+
expect(await nymph.newUID('TestUID')).toEqual(2);
|
|
1029
|
+
});
|
|
1030
|
+
it('retrieve UID', async () => {
|
|
1031
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1032
|
+
});
|
|
1033
|
+
it('rename UID', async () => {
|
|
1034
|
+
expect(await nymph.renameUID('TestUID', 'NewUID')).toEqual(true);
|
|
1035
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1036
|
+
expect(await nymph.getUID('NewUID')).toEqual(2);
|
|
1037
|
+
expect(await nymph.renameUID('NewUID', 'TestUID')).toEqual(true);
|
|
1038
|
+
expect(await nymph.getUID('NewUID')).toBeNull();
|
|
1039
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1040
|
+
});
|
|
1041
|
+
it('set UID', async () => {
|
|
1042
|
+
expect(await nymph.setUID('TestUID', 5)).toEqual(true);
|
|
1043
|
+
expect(await nymph.getUID('TestUID')).toEqual(5);
|
|
1044
|
+
});
|
|
1045
|
+
it('delete UID', async () => {
|
|
1046
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1047
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1048
|
+
});
|
|
1069
1049
|
}
|
|
1070
1050
|
exports.UIDTest = UIDTest;
|
|
1071
1051
|
function ExportImportTest(nymph, it) {
|
|
1072
1052
|
nymph.addEntityClass(testArtifacts_1.TestModel);
|
|
1073
1053
|
nymph.addEntityClass(testArtifacts_1.TestBModel);
|
|
1074
|
-
function deleteTestData() {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
expect(yield nymph.deleteUID('TestUID2')).toEqual(true);
|
|
1092
|
-
});
|
|
1054
|
+
async function deleteTestData() {
|
|
1055
|
+
let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1056
|
+
expect(Array.isArray(all)).toEqual(true);
|
|
1057
|
+
for (const cur of all) {
|
|
1058
|
+
expect(await cur.$delete()).toEqual(true);
|
|
1059
|
+
}
|
|
1060
|
+
all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1061
|
+
expect(all.length).toEqual(0);
|
|
1062
|
+
all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1063
|
+
expect(Array.isArray(all)).toEqual(true);
|
|
1064
|
+
for (const cur of all) {
|
|
1065
|
+
expect(await cur.$delete()).toEqual(true);
|
|
1066
|
+
}
|
|
1067
|
+
all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1068
|
+
expect(all.length).toEqual(0);
|
|
1069
|
+
expect(await nymph.deleteUID('TestUID')).toEqual(true);
|
|
1070
|
+
expect(await nymph.deleteUID('TestUID2')).toEqual(true);
|
|
1093
1071
|
}
|
|
1094
|
-
function checkEntityDataAndCount() {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
expect((_f = model.refArray) === null || _f === void 0 ? void 0 : _f[0].guid).not.toBeNull();
|
|
1115
|
-
expect((_g = model.refArray) === null || _g === void 0 ? void 0 : _g[0].guid).toEqual((_h = model.reference) === null || _h === void 0 ? void 0 : _h.guid);
|
|
1116
|
-
}
|
|
1072
|
+
async function checkEntityDataAndCount() {
|
|
1073
|
+
expect(await nymph.getUID('TestUID')).toEqual(2);
|
|
1074
|
+
expect(await nymph.getUID('TestUID2')).toEqual(1);
|
|
1075
|
+
const models = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1076
|
+
const bmodels = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1077
|
+
expect(models.length).toEqual(30);
|
|
1078
|
+
expect(bmodels.length).toEqual(10);
|
|
1079
|
+
const all = [...models, ...bmodels];
|
|
1080
|
+
for (const model of all) {
|
|
1081
|
+
if (model.index?.match(/^\d+a$/)) {
|
|
1082
|
+
expect(model.null).toBeNull();
|
|
1083
|
+
expect(model.string).toEqual('test');
|
|
1084
|
+
expect(model.array).toEqual(['full', 'of', 'values', 500]);
|
|
1085
|
+
expect(model.number).toEqual(30);
|
|
1086
|
+
expect(model.timestamp).toBeGreaterThanOrEqual((0, strtotime_1.default)('-2 minutes'));
|
|
1087
|
+
expect(model.reference?.guid).not.toBeNull();
|
|
1088
|
+
expect(model.reference?.string).toEqual('another');
|
|
1089
|
+
expect(model.reference?.index?.match(/^\d+b$/)).toBeTruthy();
|
|
1090
|
+
expect(model.refArray?.[0].guid).not.toBeNull();
|
|
1091
|
+
expect(model.refArray?.[0].guid).toEqual(model.reference?.guid);
|
|
1117
1092
|
}
|
|
1118
|
-
}
|
|
1093
|
+
}
|
|
1119
1094
|
}
|
|
1120
|
-
it('delete old test data', () =>
|
|
1121
|
-
|
|
1122
|
-
})
|
|
1123
|
-
it('setup data', () =>
|
|
1124
|
-
expect(
|
|
1125
|
-
expect(
|
|
1126
|
-
expect(
|
|
1095
|
+
it('delete old test data', async () => {
|
|
1096
|
+
await deleteTestData();
|
|
1097
|
+
});
|
|
1098
|
+
it('setup data', async () => {
|
|
1099
|
+
expect(await nymph.newUID('TestUID')).toEqual(1);
|
|
1100
|
+
expect(await nymph.newUID('TestUID')).toEqual(2);
|
|
1101
|
+
expect(await nymph.newUID('TestUID2')).toEqual(1);
|
|
1127
1102
|
for (let i = 0; i < 20; i++) {
|
|
1128
1103
|
const EntityClass = i < 15 ? testArtifacts_1.TestModel : testArtifacts_1.TestBModel;
|
|
1129
|
-
const testEntity =
|
|
1104
|
+
const testEntity = await EntityClass.factory();
|
|
1130
1105
|
testEntity.name = 'Entity Test ' + new Date().toLocaleString();
|
|
1131
1106
|
testEntity.null = null;
|
|
1132
1107
|
testEntity.string = 'test';
|
|
@@ -1134,33 +1109,33 @@ function ExportImportTest(nymph, it) {
|
|
|
1134
1109
|
testEntity.number = 30;
|
|
1135
1110
|
testEntity.timestamp = Date.now();
|
|
1136
1111
|
testEntity.index = i + 'a';
|
|
1137
|
-
const entityReferenceTest =
|
|
1112
|
+
const entityReferenceTest = await EntityClass.factory();
|
|
1138
1113
|
entityReferenceTest.string = 'another';
|
|
1139
1114
|
entityReferenceTest.index = i + 'b';
|
|
1140
|
-
expect(
|
|
1115
|
+
expect(await entityReferenceTest.$save()).toEqual(true);
|
|
1141
1116
|
testEntity.reference = entityReferenceTest;
|
|
1142
1117
|
testEntity.refArray = [entityReferenceTest];
|
|
1143
|
-
expect(
|
|
1118
|
+
expect(await testEntity.$save()).toEqual(true);
|
|
1144
1119
|
}
|
|
1145
|
-
|
|
1146
|
-
})
|
|
1147
|
-
it('export data', () =>
|
|
1148
|
-
expect(
|
|
1149
|
-
})
|
|
1150
|
-
it('delete test data again', () =>
|
|
1151
|
-
|
|
1152
|
-
})
|
|
1153
|
-
it('import data', () =>
|
|
1154
|
-
expect(
|
|
1155
|
-
expect(
|
|
1156
|
-
const models =
|
|
1157
|
-
const bmodels =
|
|
1120
|
+
await checkEntityDataAndCount();
|
|
1121
|
+
});
|
|
1122
|
+
it('export data', async () => {
|
|
1123
|
+
expect(await nymph.export(__dirname + '/testentityexport.nex')).toEqual(true);
|
|
1124
|
+
});
|
|
1125
|
+
it('delete test data again', async () => {
|
|
1126
|
+
await deleteTestData();
|
|
1127
|
+
});
|
|
1128
|
+
it('import data', async () => {
|
|
1129
|
+
expect(await nymph.getUID('TestUID')).toBeNull();
|
|
1130
|
+
expect(await nymph.getUID('TestUID2')).toBeNull();
|
|
1131
|
+
const models = await nymph.getEntities({ class: testArtifacts_1.TestModel });
|
|
1132
|
+
const bmodels = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
|
|
1158
1133
|
expect(models.length).toEqual(0);
|
|
1159
1134
|
expect(bmodels.length).toEqual(0);
|
|
1160
|
-
expect(
|
|
1161
|
-
|
|
1135
|
+
expect(await nymph.import(__dirname + '/testentityexport.nex')).toEqual(true);
|
|
1136
|
+
await checkEntityDataAndCount();
|
|
1162
1137
|
fs_1.default.unlinkSync(__dirname + '/testentityexport.nex');
|
|
1163
|
-
})
|
|
1138
|
+
});
|
|
1164
1139
|
}
|
|
1165
1140
|
exports.ExportImportTest = ExportImportTest;
|
|
1166
1141
|
//# sourceMappingURL=testArtifacts.js.map
|