Skip to content

Commit

Permalink
Clean up some more hostnames in tests (#1627)
Browse files Browse the repository at this point in the history
Ref #1351
  • Loading branch information
paulmelnikow committed Jul 16, 2019
1 parent a2208d1 commit c78ceb3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions tests/test_define.js
Expand Up @@ -12,7 +12,7 @@ test('define() is backward compatible', async t => {
t.ok(
nock.define([
{
scope: 'http://example.com',
scope: 'http://example.test',
// "port" has been deprecated
port: 12345,
method: 'GET',
Expand All @@ -24,7 +24,7 @@ test('define() is backward compatible', async t => {
)

await assertRejects(
got('http://example.com:12345/', { retry: 0 }),
got('http://example.test:12345/', { retry: 0 }),
({ statusCode }) => {
t.is(statusCode, 500)
return true
Expand All @@ -37,7 +37,7 @@ test('define() throws when reply is not a numeric string', t => {
() =>
nock.define([
{
scope: 'http://example.com:1451',
scope: 'http://example.test:1451',
method: 'GET',
path: '/',
reply: 'frodo',
Expand Down Expand Up @@ -173,7 +173,7 @@ test('define() works with binary buffers', t => {
t.ok(
nock.define([
{
scope: 'http://example.com',
scope: 'http://example.test',
method: 'POST',
path: '/',
body: exampleBody,
Expand All @@ -185,7 +185,7 @@ test('define() works with binary buffers', t => {

const req = http.request(
{
host: 'example.com',
host: 'example.test',
method: 'POST',
path: '/',
},
Expand Down Expand Up @@ -220,14 +220,14 @@ test('define() uses reqheaders', t => {
const auth = 'foo:bar'
const authHeader = `Basic ${Buffer.from('foo:bar').toString('base64')}`
const reqheaders = {
host: 'example.com',
host: 'example.test',
authorization: authHeader,
}

t.ok(
nock.define([
{
scope: 'http://example.com',
scope: 'http://example.test',
method: 'GET',
path: '/',
status: 200,
Expand All @@ -240,7 +240,7 @@ test('define() uses reqheaders', t => {
// This does not hit the network.
const req = http.request(
{
host: 'example.com',
host: 'example.test',
method: 'GET',
path: '/',
auth,
Expand All @@ -264,14 +264,14 @@ test('define() uses badheaders', t => {
t.ok(
nock.define([
{
scope: 'http://example.com',
scope: 'http://example.test',
method: 'GET',
path: '/',
status: 401,
badheaders: ['x-foo'],
},
{
scope: 'http://example.com',
scope: 'http://example.test',
method: 'GET',
path: '/',
status: 200,
Expand All @@ -284,7 +284,7 @@ test('define() uses badheaders', t => {

const req = http.request(
{
host: 'example.com',
host: 'example.test',
method: 'GET',
path: '/',
headers: {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_header_matching.js
Expand Up @@ -284,11 +284,11 @@ test('match all headers', async t => {

test('header manipulation', t => {
// This test seems to depend on behavior of the `http` module.
const scope = nock('http://example.com')
const scope = nock('http://example.test')
.get('/accounts')
.reply(200, { accounts: [{ id: 1, name: 'Joe Blow' }] })

const req = http.get({ host: 'example.com', path: '/accounts' }, res => {
const req = http.get({ host: 'example.test', path: '/accounts' }, res => {
res.on('end', () => {
scope.done()
t.end()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_nock_lifecycle.js
Expand Up @@ -126,13 +126,13 @@ test('is done works', t => {
})

test('isDone', async t => {
const scope = nock('http://example.com')
const scope = nock('http://example.test')
.get('/')
.reply(200, 'Hello World!')

t.notOk(scope.isDone(), 'not done when a request is outstanding')

await got('http://example.com/')
await got('http://example.test/')

t.true(scope.isDone(), 'done after request is made')
scope.done()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_persist_optionally.js
Expand Up @@ -216,7 +216,7 @@ test('stop persisting a persistent nock', async t => {
})

test("should throw an error when persist flag isn't a boolean", t => {
t.throws(() => nock('http://persist.com').persist('string'), {
t.throws(() => nock('http://example.test').persist('string'), {
message: 'Invalid arguments: argument should be a boolean',
})
t.end()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_request_overrider.js
Expand Up @@ -53,15 +53,15 @@ test('emits the response event', t => {
})

test('write callback called', t => {
const scope = nock('http://filterboddiezregexp.com')
const scope = nock('http://example.test')
.filteringRequestBody(/mia/, 'nostra')
.post('/', 'mamma nostra')
.reply(200, 'Hello World!')

let callbackCalled = false
const req = http.request(
{
host: 'filterboddiezregexp.com',
host: 'example.test',
method: 'POST',
path: '/',
port: 80,
Expand Down

0 comments on commit c78ceb3

Please sign in to comment.