Comparing version 3.1.4 to 3.2.0-beta1
@@ -49,10 +49,16 @@ /*! | ||
props = names.map(i); | ||
} else if(this.one) { | ||
props = names.filter(function(name) { | ||
return missingProperties.indexOf(i(name)) < 0; | ||
}).map(i); | ||
} | ||
var operator = (props.length === 1 ? | ||
'to have property ' : 'to have properties ') + props.join(', '); | ||
'to have property ' : 'to have '+(this.one? 'any of ' : '')+'properties ') + props.join(', '); | ||
this.params = { operator: operator }; | ||
this.assert(missingProperties.length === 0); | ||
//check that all properties presented | ||
//or if we request one of them that at least one them presented | ||
this.assert(missingProperties.length === 0 || (this.one && missingProperties.length != names.length)); | ||
@@ -75,3 +81,3 @@ // check if values in object matched expected | ||
if(wrongValues.length > 0) { | ||
if((wrongValues.length !== 0 && !this.one) || (this.one && props.length === 0)) { | ||
props = wrongValues; | ||
@@ -81,7 +87,9 @@ } | ||
operator = (props.length === 1 ? | ||
'to have property ' : 'to have properties ') + props.join(', '); | ||
'to have property ' : 'to have '+(this.one? 'any of ' : '')+'properties ') + props.join(', '); | ||
this.params = { operator: operator }; | ||
this.assert(wrongValues.length === 0); | ||
//if there is no not matched values | ||
//or there is at least one matched | ||
this.assert(wrongValues.length === 0 || (this.one && wrongValues.length != valueCheckNames.length)); | ||
} | ||
@@ -88,0 +96,0 @@ }); |
@@ -45,2 +45,3 @@ /*! | ||
context.copy = context.copyIfMissing; | ||
context.one = this.one; | ||
@@ -168,4 +169,14 @@ try { | ||
return this; | ||
}, | ||
/** | ||
* Any modifier - it affect on execution of sequenced assertion to do not check all, but any of | ||
* | ||
* @api public | ||
*/ | ||
get any() { | ||
this.one = true; | ||
return this; | ||
} | ||
}; | ||
{ | ||
"name": "should", | ||
"description": "test framework agnostic BDD-style assertions", | ||
"version": "3.1.4", | ||
"version": "3.2.0-beta1", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
269876
3180
2