Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unexpected-messy

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected-messy - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

53

lib/unexpectedMessy.js

@@ -189,9 +189,11 @@ var messy = require('messy'),

diff: function (actual, expected, output, diff, inspect, equal) {
function outputHeader(name, value) {
return (
output
.text(messy.formatHeaderName(name) + ':', 'gray')
.text(' ')
.text(value, 'cyan')
);
var isFirstHeader = true;
function outputHeader(name, value, suppressLeadingNewline) {
output
.nl(isFirstHeader || suppressLeadingNewline ? 0 : 1)
.text(messy.formatHeaderName(name) + ':', 'gray')
.text(' ')
.text(value, 'cyan')
isFirstHeader = false;
return output;
}

@@ -210,3 +212,3 @@

remainingActualHeaders.remove(headerName, actualHeaderValue);
outputHeader(headerName, actualHeaderValue).nl();
outputHeader(headerName, actualHeaderValue);
}

@@ -221,6 +223,6 @@ }

var expectedHeaderValue = remainingExpectedHeaders.get(headerName);
output.sp().error('// should be: ').text(expectedHeaderValue).nl();
output.sp().error('// should be: ').text(expectedHeaderValue);
remainingExpectedHeaders.remove(headerName, expectedHeaderValue);
} else {
output.sp().error('// should be removed').nl();
output.sp().error('// should be removed');
}

@@ -233,4 +235,5 @@ }

remainingExpectedHeaders.getAll(headerName).forEach(function (headerValue) {
output.error('// missing: ');
outputHeader(headerName, headerValue).nl();
output.nl(isFirstHeader ? 0 : 1).error('// missing: ');
isFirstHeader = false;
outputHeader(headerName, headerValue, true);
});

@@ -378,3 +381,3 @@ });

if (!actual.hasEmptyBody() || !expected.hasEmptyBody()) {
output.nl();
output.nl(2);
if (!expected.hasEmptyBody()) {

@@ -631,3 +634,3 @@ var isJson = /^application\/json\b|\+json/i.test(expected.headers.get('Content-Type'));

var expectedStatusLine = new messy.StatusLine(value);
if (typeof expectedStatusLine.statusMessage === 'undefined') {
if (typeof expectedStatusLine.statusMessage === 'undefined' && typeof subject.statusMessage !== 'undefined') {
expectedStatusLine.statusMessage = statusMessageByStatusCode[expectedStatusLine.statusCode];

@@ -702,8 +705,10 @@ }

}
output.nl();
try {
expectMessageToSatisfy.call(that, expect, subject, value);
output.append(expect.findTypeOf(new messy.Message()).inspect(subject, 3, output.clone(), inspect, equal));
var inspectedMessage = expect.findTypeOf(new messy.Message()).inspect(subject, 3, output.clone(), inspect, equal);
if (!inspectedMessage.isEmpty()) {
output.nl().append(inspectedMessage);
}
} catch (e) {
output.append(e.createDiff(output.clone(), diff, inspect, equal).diff);
output.nl().append(e.createDiff(output.clone(), diff, inspect, equal).diff);
}

@@ -773,2 +778,7 @@ return {

} else {
if (subject.request) {
output.append(expect.inspect(subject.request));
} else {
output.text('<no request>', 'yellow');
}
if (flags.exhaustively) {

@@ -778,5 +788,3 @@ output.error('// Request not matched exhaustively');

}
if (flags.exhaustively || ('request' in value && 'response' in value)) {
output.nl(2);
}
output.nl(2);
if ('response' in value) {

@@ -790,2 +798,7 @@ try {

} else {
if (subject.response) {
output.append(expect.inspect(subject.response));
} else {
output.text('<no response>', 'yellow');
}
if (flags.exhaustively) {

@@ -792,0 +805,0 @@ output.error('// Response not matched exhaustively');

{
"name": "unexpected-messy",
"version": "1.3.0",
"version": "1.4.0",
"description": "Unexpected plugin for the messy library",

@@ -36,3 +36,3 @@ "main": "lib/unexpectedMessy.js",

"messy": "~1.3.1",
"unexpected": ">=5.0.0-beta10"
"unexpected": ">=5.0.0-beta13"
},

@@ -45,4 +45,4 @@ "devDependencies": {

"mocha": "=1.21.4",
"unexpected": ">=5.0.0-beta10"
"unexpected": ">=5.0.0-beta13"
}
}

@@ -53,3 +53,3 @@ /*global describe, it*/

'Quux: Baz\n' +
'// missing: Baz: Blah\n'
'// missing: Baz: Blah'
);

@@ -65,3 +65,3 @@ });

'Baz: Blah // should be removed\n' +
'Quux: Baz\n'
'Quux: Baz'
);

@@ -76,3 +76,3 @@ });

'Foo: Bar // should be: Baz\n' +
'Quux: Baz // should be: Blaz\n'
'Quux: Baz // should be: Blaz'
);

@@ -87,3 +87,3 @@ });

'Foo: Baz\n' +
'Foo: Bar // should be: Blah\n'
'Foo: Bar // should be: Blah'
);

@@ -98,3 +98,3 @@ });

'Foo: Bar\n' +
'Foo: Baz // should be: Blaz\n'
'Foo: Baz // should be: Blaz'
);

@@ -101,0 +101,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc