|
|
@@ -12,8 +12,8 @@ module.exports = {
|
|
|
size = new SizeMatchExpression();
|
|
|
|
|
|
assert.strictEqual(size.init("", 2).code, 'OK');
|
|
|
- assert.ok(size.matchesSingleElement(match.firstElement()));
|
|
|
- assert.ok(!size.matchesSingleElement(notMatch.firstElement()));
|
|
|
+ assert.ok(size.matchesSingleElement(match.a));
|
|
|
+ assert.ok(!size.matchesSingleElement(notMatch.a));
|
|
|
},
|
|
|
|
|
|
"Should not match non array": function() {
|
|
|
@@ -24,18 +24,18 @@ module.exports = {
|
|
|
size = new SizeMatchExpression();
|
|
|
|
|
|
assert.strictEqual(size.init("", 0).code, 'OK');
|
|
|
- assert.ok(!size.matchesSingleElement(stringValue.firstElement()));
|
|
|
- assert.ok(!size.matchesSingleElement(numberValue.firstElement()));
|
|
|
- assert.ok(size.matchesSingleElement(arrayValue.firstElement()));
|
|
|
+ assert.ok(!size.matchesSingleElement(stringValue.a));
|
|
|
+ assert.ok(!size.matchesSingleElement(numberValue.a));
|
|
|
+ assert.ok(size.matchesSingleElement(arrayValue.a));
|
|
|
},
|
|
|
|
|
|
"Should match an array": function() {
|
|
|
var size = new SizeMatchExpression();
|
|
|
|
|
|
assert.strictEqual(size.init("a", 2).code, 'OK');
|
|
|
- assert.strictEqual(size.matches({"a":[4, 5.5]}, null));
|
|
|
+ assert.ok(size.matches({"a":[4, 5.5]}, null));
|
|
|
// Arrays are not unwound to look for matching subarrays.
|
|
|
- assert.strictEqual(!size.matches({"a":[4, 5.5, [1,2]]}, null));
|
|
|
+ assert.ok(!size.matches({"a":[4, 5.5, [1,2]]}, null));
|
|
|
},
|
|
|
|
|
|
"Should match a nested array": function() {
|
|
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
|
|
|
|
assert.strictEqual(size.init("a.2", 2).code, 'OK');
|
|
|
// A numerically referenced nested array is matched.
|
|
|
- assert.strictEqual(size.matches({"a":[4, 5.5, [1, 2]]}, null));
|
|
|
+ assert.ok(size.matches({"a":[4, 5.5, [1, 2]]}, null));
|
|
|
},
|
|
|
|
|
|
"ElemMatchKey should return the appropriate results": function() {
|
|
|
@@ -52,11 +52,11 @@ module.exports = {
|
|
|
|
|
|
assert.strictEqual(size.init("a.b", 3).code, 'OK');
|
|
|
details.requestElemMatchKey();
|
|
|
- assert.strictEqual(!size.matches({"a":1}, details));
|
|
|
+ assert.ok(!size.matches({"a":1}, details));
|
|
|
assert.ok(!details.hasElemMatchKey());
|
|
|
- assert.strictEqual(size.matches({"a":{"b":[1, 2, 3]}}, details));
|
|
|
+ assert.ok(size.matches({"a":{"b":[1, 2, 3]}}, details));
|
|
|
assert.ok(!details.hasElemMatchKey());
|
|
|
- assert.strictEqual(size.matches({"a":[2, {"b":[1, 2, 3]}]}, details));
|
|
|
+ assert.ok(size.matches({"a":[2, {"b":[1, 2, 3]}]}, details));
|
|
|
assert.ok(details.hasElemMatchKey());
|
|
|
assert.strictEqual("1", details.elemMatchKey());
|
|
|
},
|