@izara_project/izara-testing-shared 1.0.5 → 1.0.6
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/package.json +1 -1
- package/src/TestingLib.js +247 -166
package/package.json
CHANGED
package/src/TestingLib.js
CHANGED
|
@@ -19,7 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
import isEqual from 'lodash.isequal';
|
|
21
21
|
const MAX_RECURSION_LEVEL = 20;
|
|
22
|
-
|
|
22
|
+
// import correlationIds from '@izara_project/izara-core-library-correlation-ids';
|
|
23
|
+
// import logger from "@izara_project/izara-core-library-logger"
|
|
24
|
+
// import integrationTestDetail from "@izara_project/izara-core-library-integration-tests"
|
|
25
|
+
// import resourceUse from "@izara_project/izara-core-library-resource-use";
|
|
26
|
+
// let _izContext = {
|
|
27
|
+
// correlationIds: correlationIds,
|
|
28
|
+
// logger: logger,
|
|
29
|
+
// integrationTestDetail: integrationTestDetail,
|
|
30
|
+
// resourceUse: resourceUse
|
|
31
|
+
// }
|
|
23
32
|
/**
|
|
24
33
|
* @param {object} _izContext - The CorrelationId and Logger instances
|
|
25
34
|
* @param {object} testEventConfigOneLevel - Event config for tesing
|
|
@@ -39,10 +48,10 @@ function checkOutputEventOneLevel(
|
|
|
39
48
|
propertyNotPass = []
|
|
40
49
|
) {
|
|
41
50
|
_izContext.logger.debug("Lib checkOutputEventOneLevel:", {
|
|
42
|
-
testEventConfigOneLevel,
|
|
43
|
-
eventForTestingOneLevel,
|
|
44
|
-
level,
|
|
45
|
-
notPassPrefix,
|
|
51
|
+
// testEventConfigOneLevel,
|
|
52
|
+
// eventForTestingOneLevel,
|
|
53
|
+
// level,
|
|
54
|
+
// notPassPrefix,
|
|
46
55
|
propertyNotPass
|
|
47
56
|
});
|
|
48
57
|
|
|
@@ -53,14 +62,19 @@ function checkOutputEventOneLevel(
|
|
|
53
62
|
};
|
|
54
63
|
//check response/outputEvent // recusive level 2 cannot find eventValue or eventParams
|
|
55
64
|
|
|
56
|
-
if (!testEventConfigOneLevel.hasOwnProperty('eventValue')
|
|
65
|
+
if (!testEventConfigOneLevel.hasOwnProperty('eventValue')
|
|
66
|
+
&& !testEventConfigOneLevel.hasOwnProperty('properties')
|
|
67
|
+
&& !testEventConfigOneLevel.hasOwnProperty('value')) {
|
|
57
68
|
throw new Error(`outputEvent not have eventValue and properties and value.`)
|
|
58
69
|
};
|
|
59
70
|
|
|
60
71
|
if (testEventConfigOneLevel.hasOwnProperty('eventValue')) {
|
|
61
72
|
_izContext.logger.debug('Case eventValue');
|
|
62
|
-
if (!testEventConfigOneLevel.hasOwnProperty('testValueMatches')
|
|
63
|
-
|
|
73
|
+
if (!testEventConfigOneLevel.hasOwnProperty('testValueMatches')
|
|
74
|
+
|| testEventConfigOneLevel.testValueMatches !== false) {
|
|
75
|
+
|
|
76
|
+
if (testEventConfigOneLevel.hasOwnProperty('useIsEqual')
|
|
77
|
+
&& testEventConfigOneLevel.useIsEqual === true) {
|
|
64
78
|
if (isEqual(eventForTestingOneLevel, testEventConfigOneLevel.eventValue) == false) {
|
|
65
79
|
_izContext.logger.debug('test isEqual failed');
|
|
66
80
|
propertyNotPass.push({
|
|
@@ -76,154 +90,180 @@ function checkOutputEventOneLevel(
|
|
|
76
90
|
return
|
|
77
91
|
}
|
|
78
92
|
|
|
79
|
-
} else if (testEventConfigOneLevel.hasOwnProperty('properties')
|
|
93
|
+
} else if (testEventConfigOneLevel.hasOwnProperty('properties')
|
|
94
|
+
&& typeof testEventConfigOneLevel === 'object') {
|
|
80
95
|
_izContext.logger.debug("Case: properties", {
|
|
81
96
|
"testEventConfigOneLevel.properties": testEventConfigOneLevel.properties,
|
|
82
97
|
"eventForTestingOneLevel": eventForTestingOneLevel
|
|
83
98
|
});
|
|
84
99
|
|
|
85
100
|
for (const [propertyName, propertyConfig] of Object.entries(testEventConfigOneLevel.properties)) {
|
|
86
|
-
_izContext.logger.debug('
|
|
87
|
-
_izContext.logger.debug('
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} else {
|
|
149
|
-
// if config not have value the test is not valid, test fails and note in the result
|
|
150
|
-
if (!propertyConfig.hasOwnProperty('value')) {
|
|
151
|
-
propertyNotPass.push({
|
|
152
|
-
prefix: notPassPrefix,
|
|
153
|
-
expectedValue: "(NO VALUE SET IN CONFIG)",
|
|
154
|
-
receivedValue: eventForTestingOneLevel[propertyName],
|
|
155
|
-
propertyName: propertyName,
|
|
156
|
-
propertyConfig: propertyConfig
|
|
157
|
-
})
|
|
158
|
-
// propertyNotPass.push(notPassPrefix + `(NO VALUE SET IN CONFIG) ${propertyName}: ${JSON.stringify(propertyConfig)}`)
|
|
159
|
-
} else {
|
|
160
|
-
// suport empty Object
|
|
161
|
-
if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
|
|
162
|
-
_izContext.logger.debug("check Object")
|
|
163
|
-
if (Object.keys(eventForTestingOneLevel[propertyName]).length > 0 && Object.keys(propertyConfig.value).length > 0) {
|
|
164
|
-
// console.log("invalid object should be set propertise inside for recuresive value in object");
|
|
165
|
-
propertyNotPass.push({
|
|
166
|
-
prefix: notPassPrefix,
|
|
167
|
-
expectedValue: `invalid check object much be set 'propertise' inside for recuresive value in object(${propertyConfig.value})`,
|
|
168
|
-
receivedValue: eventForTestingOneLevel[propertyName],
|
|
169
|
-
propertyName: propertyName,
|
|
170
|
-
propertyConfig: propertyConfig
|
|
171
|
-
})
|
|
172
|
-
|
|
101
|
+
_izContext.logger.debug('Loop testEventConfigOneLevel:', { propertyName, propertyConfig });
|
|
102
|
+
_izContext.logger.debug('find propertyName in eventForTestingOneLevel', eventForTestingOneLevel[propertyName]);
|
|
103
|
+
|
|
104
|
+
// 0 , false, == falsy
|
|
105
|
+
if (eventForTestingOneLevel[propertyName]
|
|
106
|
+
|| (typeof eventForTestingOneLevel[propertyName] == 'number' && eventForTestingOneLevel[propertyName] == 0)
|
|
107
|
+
|| (typeof eventForTestingOneLevel[propertyName] == 'boolean' && eventForTestingOneLevel[propertyName] == false)
|
|
108
|
+
|
|
109
|
+
)
|
|
110
|
+
if (eventForTestingOneLevel.hasOwnProperty(propertyName)) {
|
|
111
|
+
if (eventForTestingOneLevel[propertyName]
|
|
112
|
+
|| (typeof eventForTestingOneLevel[propertyName] == "boolean" || (typeof eventForTestingOneLevel[propertyName] == "number") || (typeof eventForTestingOneLevel[propertyName] == "undefined"))
|
|
113
|
+
) {
|
|
114
|
+
// validate testValueMatches
|
|
115
|
+
// continue to test property if set testValueMatches to false
|
|
116
|
+
if ((!propertyConfig.hasOwnProperty('testValueMatches')
|
|
117
|
+
|| propertyConfig.testValueMatches !== false)
|
|
118
|
+
|| (propertyConfig.hasOwnProperty('forStageMatching')
|
|
119
|
+
&& propertyConfig.forStageMatching === true)) {
|
|
120
|
+
|
|
121
|
+
_izContext.logger.debug("case forStageMatching is true", propertyConfig);
|
|
122
|
+
if (propertyConfig.stringified) {
|
|
123
|
+
_izContext.logger.debug('stringified::::', propertyConfig.stringified);
|
|
124
|
+
eventForTestingOneLevel[propertyName] = JSON.parse(eventForTestingOneLevel[propertyName]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
//== check config matching to massege.
|
|
128
|
+
if (!eventForTestingOneLevel.hasOwnProperty(propertyName)) {
|
|
129
|
+
_izContext.logger.debug("eventForTestingOneLevel not have propertyName:", propertyName);
|
|
130
|
+
|
|
131
|
+
// propertyNotPass.push(notPassPrefix + `${propertyName}: ${JSON.stringify(propertyConfig)}`)
|
|
132
|
+
propertyNotPass.push({
|
|
133
|
+
prefix: notPassPrefix,
|
|
134
|
+
expectedValue: `(NO propertyName SET IN CONFIG)`,
|
|
135
|
+
receivedValue: eventForTestingOneLevel[propertyName],
|
|
136
|
+
propertyName: propertyName,
|
|
137
|
+
propertyConfig: propertyConfig
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
else if (propertyConfig.eventValue) {
|
|
141
|
+
_izContext.logger.debug('eventValue::::', propertyConfig.eventValue);
|
|
142
|
+
//calling recursive function again.
|
|
143
|
+
this.checkOutputEventOneLevel(
|
|
144
|
+
_izContext,
|
|
145
|
+
propertyConfig,
|
|
146
|
+
eventForTestingOneLevel[propertyName],
|
|
147
|
+
level + 1,
|
|
148
|
+
notPassPrefix,
|
|
149
|
+
propertyNotPass
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
else if (propertyConfig.properties) {
|
|
153
|
+
_izContext.logger.debug("properties::::", propertyConfig.properties);
|
|
154
|
+
|
|
155
|
+
if (
|
|
156
|
+
(typeof (propertyConfig.properties.value) == 'object'
|
|
157
|
+
&& (Object.keys(propertyConfig.properties.value).length === 0))
|
|
158
|
+
&& (typeof (eventForTestingOneLevel[propertyName]) == 'object'
|
|
159
|
+
&& Object.keys(eventForTestingOneLevel[propertyName]).length === 0)
|
|
160
|
+
) {
|
|
161
|
+
// match empty object
|
|
162
|
+
_izContext.logger.debug("match empty object", propertyConfig.properties.value, eventForTestingOneLevel[propertyName])
|
|
173
163
|
} else {
|
|
174
|
-
|
|
164
|
+
//calling recursive function again.
|
|
165
|
+
this.checkOutputEventOneLevel(
|
|
166
|
+
_izContext,
|
|
167
|
+
propertyConfig,
|
|
168
|
+
eventForTestingOneLevel[propertyName],
|
|
169
|
+
level + 1,
|
|
170
|
+
notPassPrefix,
|
|
171
|
+
propertyNotPass
|
|
172
|
+
)
|
|
173
|
+
|
|
175
174
|
};
|
|
176
175
|
} else {
|
|
177
|
-
if
|
|
178
|
-
|
|
176
|
+
// if config not have value the test is not valid, test fails and note in the result
|
|
177
|
+
if (propertyConfig.hasOwnProperty("value")) {
|
|
178
|
+
// console.log("am value");
|
|
179
|
+
if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
|
|
180
|
+
_izContext.logger.debug("check Object")
|
|
181
|
+
if (Object.keys(eventForTestingOneLevel[propertyName]).length > 0 && Object.keys(propertyConfig.value).length > 0) {
|
|
182
|
+
// console.log("invalid object should be set propertise inside for recuresive value in object");
|
|
183
|
+
propertyNotPass.push({
|
|
184
|
+
prefix: notPassPrefix,
|
|
185
|
+
expectedValue: `invalid check object much be set 'propertise' inside for recuresive value in object(${propertyConfig.value})`,
|
|
186
|
+
receivedValue: eventForTestingOneLevel[propertyName],
|
|
187
|
+
propertyName: propertyName,
|
|
188
|
+
propertyConfig: propertyConfig
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
} else {
|
|
192
|
+
_izContext.logger.debug("object is empty");
|
|
193
|
+
};
|
|
194
|
+
} else {
|
|
195
|
+
if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
196
|
+
_izContext.logger.debug("miss match v",
|
|
197
|
+
{
|
|
198
|
+
eventForTestingOneLevel: eventForTestingOneLevel,
|
|
199
|
+
event: eventForTestingOneLevel[propertyName].value,
|
|
200
|
+
config: propertyConfig.value
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
propertyNotPass.push({
|
|
205
|
+
prefix: notPassPrefix,
|
|
206
|
+
expectedValue: propertyConfig.value,
|
|
207
|
+
receivedValue: eventForTestingOneLevel[propertyName],
|
|
208
|
+
propertyName: propertyName,
|
|
209
|
+
propertyConfig: propertyConfig
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
} else if (propertyConfig.hasOwnProperty("Value")) {
|
|
214
|
+
// console.log("am Value");
|
|
215
|
+
if (eventForTestingOneLevel[propertyName].hasOwnProperty("Type")
|
|
216
|
+
&& eventForTestingOneLevel[propertyName].hasOwnProperty("Value")) {
|
|
217
|
+
|
|
218
|
+
if (eventForTestingOneLevel[propertyName].Value !== propertyConfig.Value) {
|
|
219
|
+
_izContext.logger.debug("miss match VV", {
|
|
220
|
+
event: eventForTestingOneLevel[propertyName].Value,
|
|
221
|
+
config: propertyConfig.Value
|
|
222
|
+
});
|
|
223
|
+
_izContext.logger.debug("Message attribute is miss match!");
|
|
224
|
+
propertyNotPass.push({
|
|
225
|
+
prefix: notPassPrefix,
|
|
226
|
+
expectedValue: propertyConfig.Value,
|
|
227
|
+
receivedValue: eventForTestingOneLevel[propertyName],
|
|
228
|
+
propertyName: propertyName,
|
|
229
|
+
propertyConfig: propertyConfig
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
};
|
|
234
|
+
} else {
|
|
235
|
+
_izContext.logger.debug("NO 'VALUE' SET IN CONFIG", { notPassPrefix, propertyConfig })
|
|
179
236
|
propertyNotPass.push({
|
|
180
237
|
prefix: notPassPrefix,
|
|
181
|
-
expectedValue:
|
|
238
|
+
expectedValue: "(NO 'VALUE' SET IN CONFIG)",
|
|
182
239
|
receivedValue: eventForTestingOneLevel[propertyName],
|
|
183
240
|
propertyName: propertyName,
|
|
184
241
|
propertyConfig: propertyConfig
|
|
185
242
|
})
|
|
186
|
-
}
|
|
243
|
+
};
|
|
187
244
|
}
|
|
188
|
-
|
|
245
|
+
} else {
|
|
246
|
+
_izContext.logger.debug(`propertyName: ${propertyName} not test testValueMatches.`);
|
|
247
|
+
continue
|
|
189
248
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
193
|
-
// _izContext.logger.debug("mismatch value::", {
|
|
194
|
-
// expectedValue: propertyConfig.value,
|
|
195
|
-
// receivedValue: eventForTestingOneLevel[propertyName]
|
|
196
|
-
// });
|
|
197
|
-
// // propertyNotPass.push(notPassPrefix + `${propertyName}: ${JSON.stringify(propertyConfig)}`)
|
|
198
|
-
// propertyNotPass.push({
|
|
199
|
-
// prefix: notPassPrefix,
|
|
200
|
-
// expectedValue: propertyConfig.value,
|
|
201
|
-
// receivedValue: eventForTestingOneLevel[propertyName],
|
|
202
|
-
// propertyName: propertyName,
|
|
203
|
-
// propertyConfig: propertyConfig
|
|
204
|
-
// })
|
|
205
|
-
// }
|
|
206
|
-
}
|
|
207
|
-
} else {
|
|
208
|
-
// continue to next property if property(ex.requestParams) has set testValueMatches: false.
|
|
209
|
-
// _izContext.logger.debug(`propertyName: ${propertyName} set to not test (testValueMatches is false).`);
|
|
210
|
-
_izContext.logger.debug(`propertyName: ${propertyName} not test testValueMatches.`);
|
|
211
|
-
continue
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
// // mismatch eventForTestingOneLevel
|
|
215
|
-
propertyNotPass.push({
|
|
216
|
-
prefix: notPassPrefix,
|
|
217
|
-
error: `message event is not mach test config`,
|
|
218
|
-
receivedValue: eventForTestingOneLevel,
|
|
219
|
-
expectedValue: testEventConfigOneLevel
|
|
220
|
-
})
|
|
249
|
+
} else {
|
|
221
250
|
|
|
251
|
+
// // mismatch eventForTestingOneLevel
|
|
252
|
+
propertyNotPass.push({
|
|
253
|
+
prefix: notPassPrefix,
|
|
254
|
+
error: `message event is not mach test config`,
|
|
255
|
+
receivedValue: eventForTestingOneLevel,
|
|
256
|
+
expectedValue: testEventConfigOneLevel
|
|
257
|
+
})
|
|
222
258
|
|
|
259
|
+
};
|
|
260
|
+
}
|
|
223
261
|
|
|
224
|
-
};
|
|
225
262
|
}// end for loop check test
|
|
226
263
|
}
|
|
264
|
+
if (propertyNotPass.length == 0) {
|
|
265
|
+
_izContext.logger.debug("event is matching all is passed!")
|
|
266
|
+
}
|
|
227
267
|
return propertyNotPass
|
|
228
268
|
} catch (err) {
|
|
229
269
|
console.error('error in recursion checkOutputEventOneLevel: ', err);
|
|
@@ -279,23 +319,6 @@ function matchingEventOneLevel(
|
|
|
279
319
|
// continue to next property if property(ex.requestParams) has set forStageMatching: false.
|
|
280
320
|
_izContext.logger.debug(`forStageMatching set not mtaching or default is false.`);
|
|
281
321
|
}
|
|
282
|
-
// if (testEventConfigOneLevel.hasOwnProperty('forStageMatching') && testEventConfigOneLevel.forStageMatching === true) {
|
|
283
|
-
// if (testEventConfigOneLevel.hasOwnProperty('useIsEqual') && testEventConfigOneLevel.useIsEqual === false) {
|
|
284
|
-
// if (eventForTestingOneLevel !== testEventConfigOneLevel.eventValue) { // true not equal "true"
|
|
285
|
-
// return false;
|
|
286
|
-
// }
|
|
287
|
-
// } else { // use isEqual by default is true
|
|
288
|
-
// _izContext.logger.debug('config has useIsEqual(default is true)');
|
|
289
|
-
// if (isEqual(eventForTestingOneLevel, testEventConfigOneLevel.eventValue) == false) {
|
|
290
|
-
// _izContext.logger.debug('test isEqual failed');
|
|
291
|
-
// return false;
|
|
292
|
-
// }
|
|
293
|
-
// }
|
|
294
|
-
// } else {
|
|
295
|
-
// // continue to next property if property(ex.requestParams) has set forStageMatching: false.
|
|
296
|
-
// _izContext.logger.debug(`forStageMatching set not mtaching or default is false.`);
|
|
297
|
-
// }
|
|
298
|
-
|
|
299
322
|
} else { // check if have properties
|
|
300
323
|
|
|
301
324
|
// check testEventConfigOneLevel is eventParams object output.
|
|
@@ -340,7 +363,11 @@ function matchingEventOneLevel(
|
|
|
340
363
|
_izContext.logger.debug('propertyConfig.eventValue', propertyConfig.eventValue);
|
|
341
364
|
//calling recursive function again.
|
|
342
365
|
// let checkMatched = checkOutputEventOneLevel(propertyConfig, eventForTestingOneLevel[propertyName], level + 1)
|
|
343
|
-
let checkMatched =
|
|
366
|
+
let checkMatched = matchingEventOneLevel(
|
|
367
|
+
_izContext,
|
|
368
|
+
propertyConfig,
|
|
369
|
+
eventForTestingOneLevel[propertyName],
|
|
370
|
+
level + 1)
|
|
344
371
|
if (checkMatched == false) {
|
|
345
372
|
return false;
|
|
346
373
|
}
|
|
@@ -348,18 +375,16 @@ function matchingEventOneLevel(
|
|
|
348
375
|
else if (propertyConfig.hasOwnProperty("properties")) {
|
|
349
376
|
_izContext.logger.debug("[matchingEventOneLevel]propertyConfig.properties");
|
|
350
377
|
|
|
351
|
-
let checkMatched =
|
|
378
|
+
let checkMatched = matchingEventOneLevel(
|
|
379
|
+
_izContext,
|
|
380
|
+
propertyConfig,
|
|
381
|
+
eventForTestingOneLevel[propertyName],
|
|
382
|
+
level + 1
|
|
383
|
+
)
|
|
352
384
|
if (checkMatched == false) {
|
|
353
385
|
return false;
|
|
354
|
-
}
|
|
386
|
+
};
|
|
355
387
|
}
|
|
356
|
-
//old----------------
|
|
357
|
-
// else if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
358
|
-
// console.log("misMatch", { valueEvent: eventForTestingOneLevel[propertyName], valueConfig: propertyConfig.value });
|
|
359
|
-
|
|
360
|
-
// return false;
|
|
361
|
-
// }// is not check empty Object
|
|
362
|
-
|
|
363
388
|
else { // new ------------------------
|
|
364
389
|
// suport empty Object
|
|
365
390
|
if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
|
|
@@ -371,10 +396,34 @@ function matchingEventOneLevel(
|
|
|
371
396
|
_izContext.logger.debug("0000 is Empty object");
|
|
372
397
|
}
|
|
373
398
|
} else {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
399
|
+
// check value
|
|
400
|
+
if (propertyConfig.hasOwnProperty("value")) {
|
|
401
|
+
if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
402
|
+
_izContext.logger.debug("event is miss match!", { event: eventForTestingOneLevel[propertyName], testConfig: propertyConfig.value });
|
|
403
|
+
return false
|
|
404
|
+
};
|
|
405
|
+
} else if (propertyConfig.hasOwnProperty("Value")) {
|
|
406
|
+
_izContext.logger.debug("check Value of Attribute");
|
|
407
|
+
if (eventForTestingOneLevel[propertyName].hasOwnProperty("Type")
|
|
408
|
+
&& eventForTestingOneLevel[propertyName].hasOwnProperty("Value")) {
|
|
409
|
+
_izContext.logger.debug("messageAttTestConfig:", propertyConfig.Value);
|
|
410
|
+
_izContext.logger.debug("messageAttEvent:", eventForTestingOneLevel[propertyName].Value);
|
|
411
|
+
|
|
412
|
+
if (eventForTestingOneLevel[propertyName].Value !== propertyConfig.Value) {
|
|
413
|
+
_izContext.logger.debug("Message attribute is miss match!", {
|
|
414
|
+
event: eventForTestingOneLevel[propertyName].Value,
|
|
415
|
+
testConfig: propertyConfig.Value
|
|
416
|
+
});
|
|
417
|
+
return false
|
|
418
|
+
} else {
|
|
419
|
+
_izContext.logger.debug("Message attribute is match!");
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
// if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
424
|
+
// console.log("misMatch data::::", { valueEvent: eventForTestingOneLevel[propertyName], valueConfig: propertyConfig.value });
|
|
425
|
+
// return false;
|
|
426
|
+
// }
|
|
378
427
|
}
|
|
379
428
|
};
|
|
380
429
|
|
|
@@ -388,6 +437,39 @@ function matchingEventOneLevel(
|
|
|
388
437
|
}
|
|
389
438
|
return true;
|
|
390
439
|
};
|
|
440
|
+
// matchingEventOneLevel(
|
|
441
|
+
// _izContext,
|
|
442
|
+
// {
|
|
443
|
+
// properties: {
|
|
444
|
+
// callingFlow: {
|
|
445
|
+
// forStageMatching: true,
|
|
446
|
+
// Value: 'maxxCart2TestProcessValidateCart'
|
|
447
|
+
// },
|
|
448
|
+
// 'x-correlation-base-user-id': {
|
|
449
|
+
// forStageMatching: true,
|
|
450
|
+
// Value: 'maxx'
|
|
451
|
+
|
|
452
|
+
// }
|
|
453
|
+
// }
|
|
454
|
+
// },
|
|
455
|
+
// {
|
|
456
|
+
// callingFlow: { Type: 'String', Value: 'maxxCart2TestProcessValidateCart' },
|
|
457
|
+
// 'x-correlation-intTest-time': { Type: 'String', Value: '1766387880112' },
|
|
458
|
+
// 'x-correlation-intTest-serviceTag': { Type: 'String', Value: 'IntTesting' },
|
|
459
|
+
// 'x-correlation-call-chain-length': { Type: 'String', Value: '1' },
|
|
460
|
+
// 'x-correlation-intTest-tag': {
|
|
461
|
+
// Type: 'String',
|
|
462
|
+
// Value: 'validateCart_cartValidationStatus_valid_CaseCombineWinIsTrueAndFalse_ESmodule_003_Complete'
|
|
463
|
+
// },
|
|
464
|
+
// serviceTag: { Type: 'String', Value: 'IntTesting' },
|
|
465
|
+
// 'x-correlation-id': { Type: 'String', Value: 'b0e7188c-32c0-428a-8202-c15642445e63' },
|
|
466
|
+
// 'x-correlation-debug-log-enabled': { Type: 'String', Value: 'false' },
|
|
467
|
+
// 'x-correlation-base-user-id': { Type: 'String', Value: 'maxx' }
|
|
468
|
+
// },
|
|
469
|
+
// 1
|
|
470
|
+
|
|
471
|
+
// )
|
|
472
|
+
|
|
391
473
|
// end recursive function
|
|
392
474
|
|
|
393
475
|
|
|
@@ -399,7 +481,6 @@ function isObject(object) {
|
|
|
399
481
|
return false
|
|
400
482
|
};
|
|
401
483
|
|
|
402
|
-
|
|
403
484
|
export default {
|
|
404
485
|
checkOutputEventOneLevel,
|
|
405
486
|
matchingEventOneLevel
|