Skip to content

Commit

Permalink
Update intercept tests for new stringified format
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwsperber committed Jan 19, 2017
1 parent eafceac commit 794821d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ test("emits error if https route is missing", function(t) {
// This listener is intentionally after the end call so make sure that
// listeners added after the end will catch the error
req.on('error', function (err) {
t.equal(err.message.trim(), 'Nock: No match for request GET https://google.com/abcdef892932');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"https://google.com/abcdef892932","body":""}');
t.end();
});
});
Expand All @@ -1893,7 +1893,7 @@ test("emits error if https route is missing", function(t) {
// This listener is intentionally after the end call so make sure that
// listeners added after the end will catch the error
req.on('error', function (err) {
t.equal(err.message.trim(), 'Nock: No match for request GET https://google.com:123/dsadsads');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"https://google.com:123/dsadsads","body":""}');
t.end();
});
});
Expand Down Expand Up @@ -4574,7 +4574,7 @@ test('you must setup an interceptor for each request', function(t) {
t.equal(body, 'First match', 'should match first request response body');

mikealRequest.get('http://www.example.com/hey', function(error, res, body) {
t.equal(error && error.toString(), 'Error: Nock: No match for request GET http://www.example.com/hey ');
t.equal(error && error.toString(), 'Error: Nock: No match for request {"method":"GET","url":"http://www.example.com/hey","headers":{"host":"www.example.com"},"body":""}');
scope.done();
t.end();
});
Expand Down Expand Up @@ -4905,7 +4905,7 @@ test('query() with a function, function return false the query treat as Un-match
.reply(200);

mikealRequest('http://google.com/?i=should&pass=?', function(err, res) {
t.equal(err.message.trim(), 'Nock: No match for request GET http://google.com/?i=should&pass=?');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"http://google.com/?i=should&pass=?","headers":{"host":"google.com"},"body":""}');
t.end();
})
});
Expand All @@ -4917,7 +4917,7 @@ test('query() will not match when a query string does not match name=value', fun
.reply(200);

mikealRequest('https://c.com/b?foo=baz', function(err, res) {
t.equal(err.message.trim(), 'Nock: No match for request GET https://c.com/b?foo=baz');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"https://c.com/b?foo=baz","headers":{"host":"c.com"},"body":""}');
t.end();
})
});
Expand All @@ -4929,7 +4929,7 @@ test('query() will not match when a query string is present that was not registe
.reply(200);

mikealRequest('https://b.com/c?foo=bar&baz=foz', function(err, res) {
t.equal(err.message.trim(), 'Nock: No match for request GET https://b.com/c?foo=bar&baz=foz');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"https://b.com/c?foo=bar&baz=foz","headers":{"host":"b.com"},"body":""}');
t.end();
})
});
Expand All @@ -4941,7 +4941,7 @@ test('query() will not match when a query string is malformed', function (t) {
.reply(200);

mikealRequest('https://a.com/d?foobar', function(err, res) {
t.equal(err.message.trim(), 'Nock: No match for request GET https://a.com/d?foobar');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"https://a.com/d?foobar","headers":{"host":"a.com"},"body":""}');
t.end();
})
});
Expand All @@ -4958,7 +4958,7 @@ test('query() will not match when a query string has fewer correct values than e
.reply(200);

mikealRequest('http://google.com/?num=1str=fou', function(err, res) {
t.equal(err.message.trim(), 'Nock: No match for request GET http://google.com/?num=1str=fou');
t.equal(err.message.trim(), 'Nock: No match for request {"method":"GET","url":"http://google.com/?num=1str=fou","headers":{"host":"google.com"},"body":""}');
t.end();
})
});
Expand Down

0 comments on commit 794821d

Please sign in to comment.