%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
const t = require('tap') const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') const MockRegistry = require('../../fixtures/mock-registry.js') t.test('no details', async t => { const { npm, logs, joinedOutput } = await loadMockNpm(t) const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry'), }) registry.ping() await npm.exec('ping', []) t.match(logs.notice, [['PING', 'https://registry.npmjs.org/'], ['PONG', /[0-9]+ms/]]) t.equal(joinedOutput(), '') }) t.test('with details', async t => { const { npm, logs, joinedOutput } = await loadMockNpm(t) const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry'), }) registry.ping({ body: { test: true } }) await npm.exec('ping', []) t.match(logs.notice, [ ['PING', 'https://registry.npmjs.org/'], ['PONG', /[0-9]+ms/], ['PONG', '{\n "test": true\n}'], ]) t.match(joinedOutput(), '') }) t.test('valid json', async t => { const { npm, logs, joinedOutput } = await loadMockNpm(t, { config: { json: true }, }) const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry'), }) registry.ping() await npm.exec('ping', []) t.match(logs.notice, [['PING', 'https://registry.npmjs.org/'], ['PONG', /[0-9]+ms/]]) t.match(JSON.parse(joinedOutput()), { registry: npm.config.get('registry'), time: /[0-9]+/, details: {}, }) }) t.test('invalid json', async t => { const { npm, logs, joinedOutput } = await loadMockNpm(t, { config: { json: true }, }) const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry'), }) registry.ping({ body: '{not: real"json]' }) await npm.exec('ping', []) t.match(logs.notice, [['PING', 'https://registry.npmjs.org/'], ['PONG', /[0-9]+ms/]]) t.match(JSON.parse(joinedOutput()), { registry: npm.config.get('registry'), time: /[0-9]+/, details: {}, }) })