From 949d264b07b07264ac6dfcb60f930873c0d0b8de Mon Sep 17 00:00:00 2001 From: Cole Turner Date: Thu, 22 Aug 2019 09:55:47 -0700 Subject: [PATCH] test: Add todo test for conflict between hostnames (#1109) Ref #1108 --- tests/test_intercept.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/test_intercept.js b/tests/test_intercept.js index 4c4fc8351..0d7f1c89c 100644 --- a/tests/test_intercept.js +++ b/tests/test_intercept.js @@ -1047,7 +1047,8 @@ test('match domain using regexp', t => { }) }) -test('match domain using regexp with path as callback (issue-1137)', t => { +// https://github.com/nock/nock/issues/1137 +test('match domain using regexp with path as callback', t => { nock(/.*/) .get(() => true) .reply(200, 'Match regex') @@ -1060,7 +1061,8 @@ test('match domain using regexp with path as callback (issue-1137)', t => { }) }) -test('match multiple interceptors with regexp domain (issue-508)', t => { +// https://github.com/nock/nock/issues/508 +test('match multiple interceptors with regexp domain', t => { nock(/chainregex/) .get('/') .reply(200, 'Match regex') @@ -1082,6 +1084,29 @@ test('match multiple interceptors with regexp domain (issue-508)', t => { }) }) +// FIXME: This marked as { todo: true } because it is an existing bug. +// https://github.com/nock/nock/issues/1108 +test( + 'match hostname as regex and string in tandem', + { todo: true }, + async t => { + const scope1 = nock(/.*/) + .get('/hello/world') + .reply() + const scope2 = nock('http://example.test') + .get('/hello/planet') + .reply() + + const response1 = await got('http://example.test/hello/world') + t.is(response1.statusCode, 200) + scope1.done() + + const response2 = await got('http://example.test/hello/planet') + t.is(response2.statusCode, 200) + scope2.done() + } +) + test('match domain using intercept callback', t => { const validUrl = ['/cats', '/dogs']