unexpected-messy
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -234,21 +234,9 @@ var messy = require('messy'), | ||
expect(subject.parts, 'to satisfy', value.parts); | ||
} else { | ||
} else if (Array.isArray(value.parts)) { | ||
this.errorMode = 'bubble'; | ||
expect(subject, 'to have number of parts', value.parts.length); | ||
} else if (value.parts && typeof value.parts === 'object') { | ||
expect(value.parts, 'to be an object whose keys satisfy', /^\d+/); | ||
var highestPartNumber; | ||
if (Array.isArray(value.parts)) { | ||
highestPartNumber = value.parts.length; | ||
} else if (value.parts && typeof value.parts === 'object') { | ||
Object.keys(value.parts).forEach(function (key) { | ||
var partNumber = parseInt(key, 10); | ||
if (typeof partNumber === 'number' && (typeof highestPartNumber === 'undefined' || partNumber > highestPartNumber)) { | ||
highestPartNumber = partNumber; | ||
} | ||
}); | ||
} | ||
if (typeof highestPartNumber !== 'undefined') { | ||
expect(subject, 'to have at least this number of parts', highestPartNumber); | ||
} | ||
this.errorMode = 'default'; | ||
} | ||
this.errorMode = 'default'; | ||
} | ||
@@ -273,5 +261,9 @@ | ||
if (typeof value.parts !== 'undefined' && typeof value.parts !== 'function') { | ||
Object.keys(value.parts).forEach(function (key) { | ||
expect(subject.parts[key], 'to satisfy', value.parts[key]); | ||
}); | ||
if (Array.isArray(value.parts)) { | ||
expect(subject.parts, 'to satisfy', value.parts); | ||
} else { | ||
Object.keys(value.parts).forEach(function (key) { | ||
expect(subject.parts[key], 'to satisfy', value.parts[key]); | ||
}); | ||
} | ||
} | ||
@@ -689,4 +681,4 @@ } catch (e) { | ||
}) | ||
.addAssertion('messy.Message', '[not] to have at least this number of parts', function (expect, subject, value) { | ||
expect(subject.parts.length, '[not] to be >=', value); | ||
.addAssertion('messy.Message', '[not] to have number of parts', function (expect, subject, value) { | ||
expect(subject.parts, '[not] to have length', value); | ||
}) | ||
@@ -693,0 +685,0 @@ .addType({ |
{ | ||
"name": "unexpected-messy", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "Unexpected plugin for the messy library", | ||
@@ -44,3 +44,3 @@ "main": "lib/unexpectedMessy.js", | ||
"mocha": "2.0.1", | ||
"unexpected": "5.4.0" | ||
"unexpected": "5.4.2" | ||
}, | ||
@@ -47,0 +47,0 @@ "dependencies": { |
Sorry, the diff of this file is too big to display
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
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
144021
2672