unexpected-messy
Advanced tools
Comparing version 2.2.5 to 2.2.6
@@ -228,6 +228,6 @@ var messy = require('messy'), | ||
output.append(expect.inspect(subject.headers)); | ||
} catch (e) { | ||
output.append(e.createDiff(output.clone(), diff, inspect, equal).diff); | ||
} catch (e2) { | ||
output.append(e2.createDiff(output.clone(), diff, inspect, equal).diff); | ||
} | ||
var bodyDiffError, | ||
var bodySatisfyError, | ||
bodyDiffResult; | ||
@@ -237,5 +237,5 @@ if ('body' in value) { | ||
expect(subjectBody, 'to satisfy', expectedBody); | ||
} catch (e) { | ||
bodyDiffError = e; | ||
bodyDiffResult = e.createDiff && e.createDiff(output.clone(), diff, inspect, equal); | ||
} catch (e3) { | ||
bodySatisfyError = e3; | ||
bodyDiffResult = bodySatisfyError.createDiff && bodySatisfyError.createDiff(output.clone(), diff, inspect, equal); | ||
} | ||
@@ -253,5 +253,7 @@ } | ||
} | ||
if (bodyDiffError) { | ||
output.sp().error('// ' + (bodyDiffError.label || 'should satisfy') + ' ').append(inspect(expectedBody)); | ||
if (bodySatisfyError) { | ||
output.sp().error('// ' + (bodySatisfyError.label || 'should satisfy') + ' ').append(inspect(expectedBody)); | ||
} | ||
} else if (bodySatisfyError) { | ||
output.nl(2).error('// ' + (bodySatisfyError.label || 'should satisfy') + ' ').append(inspect(expectedBody)); | ||
} else if (flags.exhaustively && !subject.hasEmptyBody()) { | ||
@@ -258,0 +260,0 @@ if (typeof subjectBody === 'string') { |
{ | ||
"name": "unexpected-messy", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "Unexpected plugin for the messy library", | ||
@@ -5,0 +5,0 @@ "main": "lib/unexpectedMessy.js", |
@@ -440,2 +440,13 @@ /*global describe, it*/ | ||
}); | ||
it('should produce sensible output when matching an empty body against a regexp', function () { | ||
expect(function () { | ||
expect(new Message({headers: {Foo: 'a'}, body: ''}), 'to satisfy', {body: /bar/}); | ||
}, 'to throw', | ||
'expected Foo: a to satisfy { body: /bar/ }\n' + | ||
'\n' + | ||
'Foo: a\n' + | ||
'\n' + | ||
'// should match /bar/'); | ||
}); | ||
}); | ||
@@ -442,0 +453,0 @@ }); |
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
118240
2251