@izara_project/izara-testing-shared 1.0.2 → 1.0.4
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 +8 -8
package/package.json
CHANGED
package/src/TestingLib.js
CHANGED
|
@@ -53,15 +53,15 @@ module.exports.checkOutputEventOneLevel = (
|
|
|
53
53
|
};
|
|
54
54
|
//check response/outputEvent // recusive level 2 cannot find eventValue or eventParams
|
|
55
55
|
|
|
56
|
-
if (!testEventConfigOneLevel.hasOwnProperty('eventValue') && !testEventConfigOneLevel.hasOwnProperty('properties')) {
|
|
57
|
-
throw new Error(`outputEvent not have eventValue and
|
|
56
|
+
if (!testEventConfigOneLevel.hasOwnProperty('eventValue') && !testEventConfigOneLevel.hasOwnProperty('properties') && !testEventConfigOneLevel.hasOwnProperty('value')) {
|
|
57
|
+
throw new Error(`outputEvent not have eventValue and properties and value.`)
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
if (testEventConfigOneLevel.hasOwnProperty('eventValue')) {
|
|
61
61
|
_izContext.logger.debug('Case eventValue');
|
|
62
|
-
if (!testEventConfigOneLevel.hasOwnProperty('testValueMatches') || testEventConfigOneLevel.testValueMatches
|
|
62
|
+
if (!testEventConfigOneLevel.hasOwnProperty('testValueMatches') || testEventConfigOneLevel.testValueMatches !== false) {
|
|
63
63
|
if (testEventConfigOneLevel.hasOwnProperty('useIsEqual') && testEventConfigOneLevel.useIsEqual === false) {
|
|
64
|
-
if (eventForTestingOneLevel
|
|
64
|
+
if (eventForTestingOneLevel !== testEventConfigOneLevel.eventValue) { // true not equal "true"
|
|
65
65
|
// propertyNotPass.push(notPassPrefix + JSON.stringify(testEventConfigOneLevel.eventValue))
|
|
66
66
|
propertyNotPass.push({
|
|
67
67
|
prefix: notPassPrefix,
|
|
@@ -111,7 +111,7 @@ module.exports.checkOutputEventOneLevel = (
|
|
|
111
111
|
if (eventForTestingOneLevel[propertyName]) {
|
|
112
112
|
// validate testValueMatches
|
|
113
113
|
// continue to test property if set testValueMatches to false
|
|
114
|
-
if ((!propertyConfig.hasOwnProperty('testValueMatches') || propertyConfig.testValueMatches
|
|
114
|
+
if ((!propertyConfig.hasOwnProperty('testValueMatches') || propertyConfig.testValueMatches !== false)
|
|
115
115
|
|| (propertyConfig.hasOwnProperty('forStageMatching') && propertyConfig.forStageMatching === true)) {
|
|
116
116
|
|
|
117
117
|
_izContext.logger.debug("forStageMatching is true", propertyConfig);
|
|
@@ -180,7 +180,7 @@ module.exports.checkOutputEventOneLevel = (
|
|
|
180
180
|
}
|
|
181
181
|
// do the standard test
|
|
182
182
|
|
|
183
|
-
if (eventForTestingOneLevel[propertyName]
|
|
183
|
+
if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
184
184
|
_izContext.logger.debug("mismatch value::", {
|
|
185
185
|
expectedValue: propertyConfig.value,
|
|
186
186
|
receivedValue: eventForTestingOneLevel[propertyName]
|
|
@@ -248,7 +248,7 @@ module.exports.matchingEventOneLevel = (
|
|
|
248
248
|
_izContext.logger.debug('case eventValue');
|
|
249
249
|
if (testEventConfigOneLevel.hasOwnProperty('forStageMatching') && testEventConfigOneLevel.forStageMatching === true) {
|
|
250
250
|
if (testEventConfigOneLevel.hasOwnProperty('useIsEqual') && testEventConfigOneLevel.useIsEqual === false) {
|
|
251
|
-
if (eventForTestingOneLevel
|
|
251
|
+
if (eventForTestingOneLevel !== testEventConfigOneLevel.eventValue) { // true not equal "true"
|
|
252
252
|
return false;
|
|
253
253
|
}
|
|
254
254
|
} else { // use isEqual by default is true
|
|
@@ -318,7 +318,7 @@ module.exports.matchingEventOneLevel = (
|
|
|
318
318
|
if (checkMatched == false) {
|
|
319
319
|
return false;
|
|
320
320
|
}
|
|
321
|
-
} else if (eventForTestingOneLevel[propertyName]
|
|
321
|
+
} else if (eventForTestingOneLevel[propertyName] !== propertyConfig.value) {
|
|
322
322
|
console.log("misMatch", { valueEvent: eventForTestingOneLevel[propertyName], valueConfig: propertyConfig.value });
|
|
323
323
|
|
|
324
324
|
return false;
|