@izara_project/izara-testing-shared 1.0.7 → 1.0.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/TestingLib.js +267 -261
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-testing-shared",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Libraries shared by both local and deployed test environments",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/TestingLib.js CHANGED
@@ -48,9 +48,9 @@ function checkOutputEventOneLevel(
48
48
  propertyNotPass = []
49
49
  ) {
50
50
  _izContext.logger.debug("Lib checkOutputEventOneLevel:", {
51
- // testEventConfigOneLevel,
52
- // eventForTestingOneLevel,
53
- // level,
51
+ testEventConfigOneLevel,
52
+ eventForTestingOneLevel,
53
+ level,
54
54
  // notPassPrefix,
55
55
  propertyNotPass
56
56
  });
@@ -90,8 +90,9 @@ function checkOutputEventOneLevel(
90
90
  return
91
91
  }
92
92
 
93
- } else if (testEventConfigOneLevel.hasOwnProperty('properties')
94
- && typeof testEventConfigOneLevel === 'object') {
93
+ } else if ((testEventConfigOneLevel.hasOwnProperty('properties')
94
+ && typeof testEventConfigOneLevel === 'object')) {
95
+
95
96
  _izContext.logger.debug("Case: properties", {
96
97
  "testEventConfigOneLevel.properties": testEventConfigOneLevel.properties,
97
98
  "eventForTestingOneLevel": eventForTestingOneLevel
@@ -100,165 +101,168 @@ function checkOutputEventOneLevel(
100
101
  for (const [propertyName, propertyConfig] of Object.entries(testEventConfigOneLevel.properties)) {
101
102
  _izContext.logger.debug('Loop testEventConfigOneLevel:', { propertyName, propertyConfig });
102
103
  _izContext.logger.debug('find propertyName in eventForTestingOneLevel', eventForTestingOneLevel[propertyName]);
103
-
104
+ if (propertyConfig.hasOwnProperty('testValueMatches') && propertyConfig.testValueMatches == false) {
105
+ _izContext.logger.debug("**not test value matches,continue**", propertyName);
106
+ continue
107
+ };
104
108
  // 0 , false, == falsy
105
109
  if (eventForTestingOneLevel[propertyName]
106
110
  || (typeof eventForTestingOneLevel[propertyName] == 'number' && eventForTestingOneLevel[propertyName] == 0)
107
111
  || (typeof eventForTestingOneLevel[propertyName] == 'boolean' && eventForTestingOneLevel[propertyName] == false)
108
112
 
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
- };
113
+ ) {
114
+
115
+ if (propertyConfig.stringified) {
116
+ _izContext.logger.debug('stringified::::', propertyConfig.stringified);
117
+ eventForTestingOneLevel[propertyName] = JSON.parse(eventForTestingOneLevel[propertyName]);
118
+ };
119
+
120
+ //== check config matching to massege.
121
+ if (!eventForTestingOneLevel.hasOwnProperty(propertyName)) {
122
+ _izContext.logger.debug("eventForTestingOneLevel not have propertyName:", propertyName);
126
123
 
127
- //== check config matching to massege.
128
- if (!eventForTestingOneLevel.hasOwnProperty(propertyName)) {
129
- _izContext.logger.debug("eventForTestingOneLevel not have propertyName:", propertyName);
124
+ // propertyNotPass.push(notPassPrefix + `${propertyName}: ${JSON.stringify(propertyConfig)}`)
125
+ propertyNotPass.push({
126
+ prefix: notPassPrefix,
127
+ expectedValue: `(NO propertyName SET IN CONFIG)`,
128
+ receivedValue: eventForTestingOneLevel[propertyName],
129
+ propertyName: propertyName,
130
+ propertyConfig: propertyConfig
131
+ })
132
+ }
133
+ else if (propertyConfig.eventValue) {
134
+ _izContext.logger.debug('eventValue::::', propertyConfig.eventValue);
135
+ //calling recursive function again.
136
+ this.checkOutputEventOneLevel(
137
+ _izContext,
138
+ propertyConfig,
139
+ eventForTestingOneLevel[propertyName],
140
+ level + 1,
141
+ notPassPrefix,
142
+ propertyNotPass
143
+ )
144
+ }
145
+ else if (propertyConfig.properties) {
146
+ _izContext.logger.debug("properties::::", propertyConfig.properties);
147
+
148
+ if (
149
+ (typeof (propertyConfig.properties.value) == 'object'
150
+ && (Object.keys(propertyConfig.properties.value).length === 0))
151
+ && (typeof (eventForTestingOneLevel[propertyName]) == 'object'
152
+ && Object.keys(eventForTestingOneLevel[propertyName]).length === 0)
153
+ ) {
154
+ // match empty object
155
+ _izContext.logger.debug("match empty object", propertyConfig.properties.value, eventForTestingOneLevel[propertyName])
156
+ } else {
157
+ //calling recursive function again.
158
+ this.checkOutputEventOneLevel(
159
+ _izContext,
160
+ propertyConfig,
161
+ eventForTestingOneLevel[propertyName],
162
+ level + 1,
163
+ notPassPrefix,
164
+ propertyNotPass
165
+ )
130
166
 
131
- // propertyNotPass.push(notPassPrefix + `${propertyName}: ${JSON.stringify(propertyConfig)}`)
167
+ };
168
+ } else {
169
+ // if config not have value the test is not valid, test fails and note in the result
170
+ if (propertyConfig.hasOwnProperty("value")) {
171
+ // console.log("am value");
172
+ if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
173
+ _izContext.logger.debug("check Object")
174
+ if (Object.keys(eventForTestingOneLevel[propertyName]).length > 0 && Object.keys(propertyConfig.value).length > 0) {
175
+ // console.log("invalid object should be set propertise inside for recuresive value in object");
132
176
  propertyNotPass.push({
133
177
  prefix: notPassPrefix,
134
- expectedValue: `(NO propertyName SET IN CONFIG)`,
178
+ expectedValue: `invalid check object much be set 'propertise' inside for recuresive value in object(${propertyConfig.value})`,
135
179
  receivedValue: eventForTestingOneLevel[propertyName],
136
180
  propertyName: propertyName,
137
181
  propertyConfig: propertyConfig
138
182
  })
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])
163
- } else {
164
- //calling recursive function again.
165
- this.checkOutputEventOneLevel(
166
- _izContext,
167
- propertyConfig,
168
- eventForTestingOneLevel[propertyName],
169
- level + 1,
170
- notPassPrefix,
171
- propertyNotPass
172
- )
173
183
 
174
- };
175
184
  } else {
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
- }
185
+ _izContext.logger.debug("object is empty");
186
+ };
187
+ } else {
188
+ _izContext.logger.debug("-----check value-----", {
189
+ propertyName: propertyName,
190
+ eventForTestingOneLevel: eventForTestingOneLevel[propertyName],
191
+ propertyConfig: propertyConfig.value
192
+ });
193
+
194
+ if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
195
+ _izContext.logger.debug("miss match v",
196
+ {
197
+ eventForTestingOneLevel: eventForTestingOneLevel,
198
+ event: eventForTestingOneLevel[propertyName].value,
199
+ config: propertyConfig.value
212
200
  }
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 })
236
- propertyNotPass.push({
237
- prefix: notPassPrefix,
238
- expectedValue: "(NO 'VALUE' SET IN CONFIG)",
239
- receivedValue: eventForTestingOneLevel[propertyName],
240
- propertyName: propertyName,
241
- propertyConfig: propertyConfig
242
- })
243
- };
201
+ );
202
+
203
+ propertyNotPass.push({
204
+ prefix: notPassPrefix,
205
+ expectedValue: propertyConfig.value,
206
+ receivedValue: eventForTestingOneLevel[propertyName],
207
+ propertyName: propertyName,
208
+ propertyConfig: propertyConfig
209
+ });
244
210
  }
245
- } else {
246
- _izContext.logger.debug(`propertyName: ${propertyName} not test testValueMatches.`);
247
- continue
248
211
  }
249
- } else {
212
+ } else if (propertyConfig.hasOwnProperty("Value")) {
213
+ // console.log("am Value");
214
+ if (eventForTestingOneLevel[propertyName].hasOwnProperty("Type")
215
+ && eventForTestingOneLevel[propertyName].hasOwnProperty("Value")) {
216
+
217
+ if (eventForTestingOneLevel[propertyName].Value !== propertyConfig.Value) {
218
+ _izContext.logger.debug("miss match VV", {
219
+ event: eventForTestingOneLevel[propertyName].Value,
220
+ config: propertyConfig.Value
221
+ });
222
+ _izContext.logger.debug("Message attribute is miss match!");
223
+ propertyNotPass.push({
224
+ prefix: notPassPrefix,
225
+ expectedValue: propertyConfig.Value,
226
+ receivedValue: eventForTestingOneLevel[propertyName],
227
+ propertyName: propertyName,
228
+ propertyConfig: propertyConfig
229
+ });
230
+ };
250
231
 
251
- // // mismatch eventForTestingOneLevel
232
+ };
233
+ } else {
234
+ _izContext.logger.debug("NO 'VALUE' SET IN CONFIG", { notPassPrefix, propertyConfig })
252
235
  propertyNotPass.push({
253
236
  prefix: notPassPrefix,
254
- error: `message event is not mach test config`,
255
- receivedValue: eventForTestingOneLevel,
256
- expectedValue: testEventConfigOneLevel
237
+ expectedValue: "(NO 'VALUE' SET IN CONFIG)",
238
+ receivedValue: eventForTestingOneLevel[propertyName],
239
+ propertyName: propertyName,
240
+ propertyConfig: propertyConfig
257
241
  })
258
-
259
242
  };
260
243
  }
261
244
 
245
+ } else {
246
+ if (eventForTestingOneLevel[propertyName] === null && propertyConfig.value === null) {
247
+ _izContext.logger.debug("eventForTestingOneLevel is null", {
248
+ "eventForTestingOneLevel[propertyName]": eventForTestingOneLevel[propertyName],
249
+ "propertyConfig.value": propertyConfig.value
250
+ });
251
+ } else {
252
+ _izContext.logger.debug("message event is not mach test config", eventForTestingOneLevel[propertyName], { propertyName, eventForTestingOneLevel });
253
+ // // mismatch eventForTestingOneLevel
254
+ propertyNotPass.push({
255
+ prefix: notPassPrefix,
256
+ error: `message event is not mach test config`,
257
+ receivedValue: eventForTestingOneLevel,
258
+ expectedValue: testEventConfigOneLevel
259
+ })
260
+ }
261
+
262
+
263
+ // };
264
+ // }
265
+ }
262
266
  }// end for loop check test
263
267
  }
264
268
  if (propertyNotPass.length == 0) {
@@ -305,19 +309,19 @@ function matchingEventOneLevel(
305
309
 
306
310
  if (testEventConfigOneLevel.hasOwnProperty('eventValue')) {
307
311
  if (testEventConfigOneLevel.hasOwnProperty('forStageMatching') && testEventConfigOneLevel.forStageMatching === true) {
308
- if (testEventConfigOneLevel.hasOwnProperty('useIsEqual') && testEventConfigOneLevel.useIsEqual === true) {
309
- _izContext.logger.debug("Check array")// index in array is isEqual.
310
- if (isEqual(eventForTestingOneLevel, testEventConfigOneLevel.eventValue) == false) {
311
- _izContext.logger.debug('test array isEqual failed');
312
- return false;
313
- } else {
314
- _izContext.logger.debug('test array isEqual true');
312
+ _izContext.logger.debug("Check array")// index in array is isEqual.
313
+ if (isEqual(eventForTestingOneLevel, testEventConfigOneLevel.eventValue) == false) {
314
+ _izContext.logger.debug('test array isEqual failed');
315
+ // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
316
+ return false;
317
+ } else {
318
+ _izContext.logger.debug('test array isEqual true');
315
319
 
316
- }
317
320
  }
321
+
318
322
  } else {
319
323
  // continue to next property if property(ex.requestParams) has set forStageMatching: false.
320
- _izContext.logger.debug(`forStageMatching set not mtaching or default is false.`);
324
+ _izContext.logger.debug(`forStageMatching set not matching or default is false.`);
321
325
  }
322
326
  } else { // check if have properties
323
327
 
@@ -339,139 +343,141 @@ function matchingEventOneLevel(
339
343
  _izContext.logger.debug("[matching]Iterate testEventConfigOneLevel.properties:", { propertyName, propertyConfig });
340
344
  _izContext.logger.debug('eventForTestingOneLevel[propertyName]', eventForTestingOneLevel[propertyName])
341
345
 
342
- // continue to test property if set forStageMatching to false
343
- if (propertyConfig.hasOwnProperty('forStageMatching') && propertyConfig.forStageMatching === true) {
344
346
 
345
- _izContext.logger.debug("[matching] forStageMatching is true compare value", {
346
- "eventForTestingOneLevel[propertyName]": eventForTestingOneLevel[propertyName],
347
- propertyConfig: propertyConfig
348
- });
347
+ if ((!propertyConfig.hasOwnProperty('testValueMatches') || propertyConfig.testValueMatches !== false)
348
+ || (propertyConfig.hasOwnProperty('forStageMatching') && propertyConfig.forStageMatching === true)) {
349
349
 
350
- if (propertyConfig.stringified) {
351
- eventForTestingOneLevel[propertyName] = JSON.parse(eventForTestingOneLevel[propertyName]);
352
- }
353
- //== check config matching to massege.
354
350
 
355
- if (!eventForTestingOneLevel.hasOwnProperty(propertyName)) {
356
- _izContext.logger.debug(`${eventForTestingOneLevel} not have properties: ${propertyName} for matching.`);
357
- return false;
358
- }
359
- // NOT SURE - was setting all eventValue properties to also set isObject: true, try this to see if works so not need to add isObject, but seem to remember this
360
- // causes problems too.. might have to return to using isObject
361
- // else if (propertyConfig.isObject) { // send to recursion again if set isObject both properties and eventValue
362
- else if (propertyConfig.eventValue) { // send to recursion again if set isObject both properties and eventValue
363
- _izContext.logger.debug('propertyConfig.eventValue', propertyConfig.eventValue);
364
- //calling recursive function again.
365
- // let checkMatched = checkOutputEventOneLevel(propertyConfig, eventForTestingOneLevel[propertyName], level + 1)
366
- let checkMatched = matchingEventOneLevel(
367
- _izContext,
368
- propertyConfig,
369
- eventForTestingOneLevel[propertyName],
370
- level + 1)
371
- if (checkMatched == false) {
372
- return false;
351
+ if (eventForTestingOneLevel[propertyName]
352
+ || (typeof eventForTestingOneLevel[propertyName] == 'number' && eventForTestingOneLevel[propertyName] == 0)
353
+ || (typeof eventForTestingOneLevel[propertyName] == 'boolean' && eventForTestingOneLevel[propertyName] == false)
354
+
355
+ ) {
356
+ // continue to test property if set forStageMatching to false
357
+ // if ((!propertyConfig.hasOwnProperty('testValueMatches')
358
+ // || propertyConfig.testValueMatches !== false)
359
+ // || (propertyConfig.hasOwnProperty('forStageMatching')
360
+ // && propertyConfig.forStageMatching === true)) {
361
+
362
+ _izContext.logger.debug("[matching] forStageMatching is true compare value", {
363
+ "eventForTestingOneLevel[propertyName]": eventForTestingOneLevel[propertyName],
364
+ propertyConfig: propertyConfig
365
+ });
366
+
367
+ if (propertyConfig.stringified) {
368
+ eventForTestingOneLevel[propertyName] = JSON.parse(eventForTestingOneLevel[propertyName]);
373
369
  }
374
- }
375
- else if (propertyConfig.hasOwnProperty("properties")) {
376
- _izContext.logger.debug("[matchingEventOneLevel]propertyConfig.properties");
370
+ //== check config matching to massege.
377
371
 
378
- let checkMatched = matchingEventOneLevel(
379
- _izContext,
380
- propertyConfig,
381
- eventForTestingOneLevel[propertyName],
382
- level + 1
383
- )
384
- if (checkMatched == false) {
372
+ if (!eventForTestingOneLevel.hasOwnProperty(propertyName)) {
373
+ _izContext.logger.debug(`${eventForTestingOneLevel} not have properties: ${propertyName} for matching.`);
385
374
  return false;
386
- };
387
- }
388
- else { // new ------------------------
389
- // suport empty Object
390
- if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
391
- _izContext.logger.debug("check Object")
392
- if (Object.keys(eventForTestingOneLevel[propertyName]).length > 0 && Object.keys(propertyConfig.value).length > 0) {
393
- console.log("invalid object should be set propertise inside for recuresive value in object");
394
- return false
395
- } else {
396
- _izContext.logger.debug("0000 is Empty object");
375
+ }
376
+ // NOT SURE - was setting all eventValue properties to also set isObject: true, try this to see if works so not need to add isObject, but seem to remember this
377
+ // causes problems too.. might have to return to using isObject
378
+ // else if (propertyConfig.isObject) { // send to recursion again if set isObject both properties and eventValue
379
+ else if (propertyConfig.eventValue) { // send to recursion again if set isObject both properties and eventValue
380
+ _izContext.logger.debug('propertyConfig.eventValue', propertyConfig.eventValue);
381
+ //calling recursive function again.
382
+ // [notsure] want to checkEventvalue is match, so match only propertyName is exist in config is enough, not re
383
+ let checkMatched = matchingEventOneLevel(
384
+ _izContext,
385
+ propertyConfig,
386
+ eventForTestingOneLevel[propertyName],
387
+ level + 1
388
+ );
389
+ if (checkMatched == false) {
390
+ return false;
397
391
  }
398
- } else {
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 });
392
+ } else if (propertyConfig.hasOwnProperty("properties")) {
393
+ _izContext.logger.debug("[matchingEventOneLevel]propertyConfig.properties");
394
+
395
+ let checkMatched = matchingEventOneLevel(
396
+ _izContext,
397
+ propertyConfig,
398
+ eventForTestingOneLevel[propertyName],
399
+ level + 1
400
+ )
401
+ if (checkMatched == false) {
402
+ return false;
403
+ };
404
+ } else { // new ------------------------
405
+ // suport empty Object
406
+ if (isObject(eventForTestingOneLevel[propertyName]) && isObject(propertyConfig.value)) {
407
+ _izContext.logger.debug("check Object", eventForTestingOneLevel[propertyName], propertyConfig.value);
408
+ if ((typeof (propertyConfig.properties.value) == 'object'
409
+ && (Object.keys(propertyConfig.properties.value).length === 0))
410
+ && (typeof (eventForTestingOneLevel[propertyName]) == 'object'
411
+ && Object.keys(eventForTestingOneLevel[propertyName]).length === 0)) {
412
+ console.log("invalid object should be set propertise inside for recuresive value in object");
403
413
  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
- });
414
+ } else {
415
+
416
+ let checkMatched = matchingEventOneLevel(
417
+ _izContext,
418
+ propertyConfig,
419
+ eventForTestingOneLevel[propertyName],
420
+ level + 1
421
+ );
422
+ if (checkMatched == false) {
423
+ return false;
424
+ };
425
+ }
426
+ } else {
427
+ // check value
428
+ if (propertyConfig.hasOwnProperty("value")) {
429
+ if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
430
+ _izContext.logger.debug("event is miss match!", { event: eventForTestingOneLevel[propertyName], testConfig: propertyConfig.value });
417
431
  return false
418
- } else {
419
- _izContext.logger.debug("Message attribute is match!");
420
- }
432
+ };
433
+ } else if (propertyConfig.hasOwnProperty("Value")) {
434
+ _izContext.logger.debug("check Value of Attribute");
435
+ if (eventForTestingOneLevel[propertyName].hasOwnProperty("Type")
436
+ && eventForTestingOneLevel[propertyName].hasOwnProperty("Value")) {
437
+ _izContext.logger.debug("messageAttTestConfig:", propertyConfig.Value);
438
+ _izContext.logger.debug("messageAttEvent:", eventForTestingOneLevel[propertyName].Value);
439
+
440
+ if (eventForTestingOneLevel[propertyName].Value !== propertyConfig.Value) {
441
+ _izContext.logger.debug("Message attribute is miss match!", {
442
+ event: eventForTestingOneLevel[propertyName].Value,
443
+ testConfig: propertyConfig.Value
444
+ });
445
+ return false
446
+ } else {
447
+ _izContext.logger.debug("Message attribute is match!");
448
+ }
449
+ };
421
450
  };
422
- };
423
- // if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
424
- // console.log("misMatch data::::", { valueEvent: eventForTestingOneLevel[propertyName], valueConfig: propertyConfig.value });
425
- // return false;
426
- // }
451
+ // if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
452
+ // console.log("misMatch data::::", { valueEvent: eventForTestingOneLevel[propertyName], valueConfig: propertyConfig.value });
453
+ // return false;
454
+ // }
455
+ }
456
+ };
457
+
458
+ } else {
459
+ if (eventForTestingOneLevel[propertyName] === null && propertyConfig.value === null) {
460
+ _izContext.logger.debug("eventForTestingOneLevel is null", {
461
+ "eventForTestingOneLevel[propertyName]": eventForTestingOneLevel[propertyName],
462
+ "propertyConfig.value": propertyConfig.value
463
+ });
464
+ } else {
465
+ _izContext.logger.debug("propertyName not exist ineventForTestingOneLevel", eventForTestingOneLevel[propertyName], { propertyName, eventForTestingOneLevel });
466
+ return false
427
467
  }
428
- };
429
468
 
469
+
470
+ }
430
471
  } else {
431
472
  // continue to next property if property(ex.requestParams) has set forStageMatching: false.
432
- _izContext.logger.debug(`propertyName: ${propertyName} set to not matching (forStageMatching default is false).`);
473
+ _izContext.logger.debug("continute matchEventOneLevel", propertyName);
433
474
  continue
434
- }
475
+ };// end for loop check test
435
476
  }// end for loop check test
436
477
  }
437
478
  }
438
479
  return true;
439
480
  };
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
-
473
- // end recursive function
474
-
475
481
 
476
482
  function isObject(object) {
477
483