Skip to content
Snippets Groups Projects
Unverified Commit 4d7c109a authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

test: use nock for preset tests (#6449)

parent 0318efec
Branches
No related tags found
No related merge requests found
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`config/presets/github fetchJSONFile() returns JSON 1`] = `
exports[`config/presets/github/index fetchJSONFile() returns JSON 1`] = `
Object {
"from": "api",
}
`;
exports[`config/presets/github/index fetchJSONFile() returns JSON 2`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/some-filename.json",
},
]
`;
exports[`config/presets/github/index getPreset() should query preset within the file 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/somefile.json",
},
]
`;
exports[`config/presets/github/index getPreset() should query subpreset 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/somefile.json",
},
]
`;
exports[`config/presets/github/index getPreset() should return custom.json 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.machine-man-preview+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/custom.json",
},
]
`;
exports[`config/presets/github/index getPreset() should return default.json 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/default.json",
},
]
`;
exports[`config/presets/github/index getPreset() should return undefined 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.machine-man-preview+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/somefile.json",
},
]
`;
exports[`config/presets/github/index getPreset() throws if fails to parse 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/default.json",
},
]
`;
exports[`config/presets/github/index getPreset() throws if no content 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/default.json",
},
]
`;
exports[`config/presets/github/index getPreset() tries default then renovate 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/default.json",
},
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/renovate.json",
},
]
`;
exports[`config/presets/github/index getPresetFromEndpoint() uses custom endpoint 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.example.org",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.example.org/repos/some/repo/contents/default.json",
},
]
`;
exports[`config/presets/github/index getPresetFromEndpoint() uses default endpoint 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/vnd.github.v3+json",
"accept-encoding": "gzip, deflate",
"authorization": "token abc",
"host": "api.github.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://api.github.com/repos/some/repo/contents/default.json",
},
]
`;
import { mocked } from '../../../../test/util';
import { PLATFORM_FAILURE } from '../../../constants/error-messages';
import { GotResponse } from '../../../platform';
import _got from '../../../util/got';
import * as httpMock from '../../../../test/httpMock';
import { getName, mocked } from '../../../../test/util';
import * as _hostRules from '../../../util/host-rules';
import * as github from '.';
import { PartialDeep } from 'type-fest';
jest.mock('../../../util/got');
jest.mock('../../../util/host-rules');
const got: jest.Mock<PartialDeep<GotResponse>> = _got as never;
const hostRules = mocked(_hostRules);
describe('config/presets/github', () => {
const githubApiHost = 'https://api.github.com/';
const basePath = '/repos/some/repo/contents';
describe(getName(__filename), () => {
beforeEach(() => {
got.mockReset();
httpMock.setup();
hostRules.find.mockReturnValue({ token: 'abc' });
});
afterEach(() => httpMock.reset());
describe('fetchJSONFile()', () => {
it('returns JSON', async () => {
hostRules.find.mockReturnValueOnce({ token: 'abc' });
got.mockImplementationOnce(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/some-filename.json`)
.reply(200, {
content: Buffer.from('{"from":"api"}').toString('base64'),
},
}));
});
const res = await github.fetchJSONFile(
'some/repo',
'some-filename',
'https://api.github.com'
'some-filename.json',
'https://api.github.com/'
);
expect(res).toMatchSnapshot();
expect(httpMock.getTrace()).toMatchSnapshot();
});
});
describe('getPreset()', () => {
it('passes up platform-failure', async () => {
got.mockImplementationOnce(() => {
throw new Error(PLATFORM_FAILURE);
});
await expect(
github.getPreset({ packageName: 'some/repo' })
).rejects.toThrow(PLATFORM_FAILURE);
});
it('tries default then renovate', async () => {
got.mockImplementationOnce(() => {
throw new Error();
});
httpMock
.scope(githubApiHost)
.get(`${basePath}/default.json`)
.reply(500, {})
.get(`${basePath}/renovate.json`)
.reply(500, {});
await expect(
github.getPreset({ packageName: 'some/repo' })
).rejects.toThrow();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('throws if no content', async () => {
got.mockImplementationOnce(() => ({
body: {},
}));
httpMock
.scope(githubApiHost)
.get(`${basePath}/default.json`)
.reply(200, {});
await expect(
github.getPreset({ packageName: 'some/repo' })
).rejects.toThrow();
).rejects.toThrow('invalid preset JSON');
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('throws if fails to parse', async () => {
got.mockImplementationOnce(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/default.json`)
.reply(200, {
content: Buffer.from('not json').toString('base64'),
},
}));
});
await expect(
github.getPreset({ packageName: 'some/repo' })
).rejects.toThrow();
).rejects.toThrow('invalid preset JSON');
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should return default.json', async () => {
hostRules.find.mockReturnValueOnce({ token: 'abc' });
got.mockImplementationOnce(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/default.json`)
.reply(200, {
content: Buffer.from('{"foo":"bar"}').toString('base64'),
},
}));
});
const content = await github.getPreset({ packageName: 'some/repo' });
expect(content).toEqual({ foo: 'bar' });
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should query preset within the file', async () => {
hostRules.find.mockReturnValueOnce({ token: 'abc' });
got.mockImplementationOnce(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/somefile.json`)
.reply(200, {
content: Buffer.from('{"somename":{"foo":"bar"}}').toString('base64'),
},
}));
});
const content = await github.getPreset({
packageName: 'some/repo',
presetName: 'somefile/somename',
});
expect(content).toEqual({ foo: 'bar' });
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should query subpreset', async () => {
hostRules.find.mockReturnValueOnce({ token: 'abc' });
got.mockImplementation(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/somefile.json`)
.reply(200, {
content: Buffer.from(
'{"somename":{"somesubname":{"foo":"bar"}}}'
).toString('base64'),
},
}));
let content = await github.getPreset({
});
const content = await github.getPreset({
packageName: 'some/repo',
presetName: 'somefile/somename/somesubname',
});
expect(content).toEqual({ foo: 'bar' });
content = await github.getPreset({
packageName: 'some/repo',
presetName: 'somefile/wrongname/somesubname',
});
expect(content).toBeUndefined();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should return custom.json', async () => {
hostRules.find.mockReturnValueOnce({ token: 'abc' });
got.mockImplementationOnce(() => ({
body: {
httpMock
.scope(githubApiHost)
.get(`${basePath}/custom.json`)
.reply(200, {
content: Buffer.from('{"foo":"bar"}').toString('base64'),
},
}));
});
try {
global.appMode = true;
const content = await github.getPreset({
......@@ -128,21 +142,62 @@ describe('config/presets/github', () => {
} finally {
delete global.appMode;
}
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should return undefined', async () => {
httpMock
.scope(githubApiHost)
.get(`${basePath}/somefile.json`)
.reply(200, {
content: Buffer.from('{}').toString('base64'),
});
try {
global.appMode = true;
const content = await github.getPreset({
packageName: 'some/repo',
presetName: 'somefile/somename/somesubname',
});
expect(content).toBeUndefined();
} finally {
delete global.appMode;
}
expect(httpMock.getTrace()).toMatchSnapshot();
});
});
describe('getPresetFromEndpoint()', () => {
it('uses default endpoint', async () => {
httpMock
.scope(githubApiHost)
.get(`${basePath}/default.json`)
.reply(200, {
content: Buffer.from('{"from":"api"}').toString('base64'),
});
expect(
await github.getPresetFromEndpoint('some/repo', 'default')
).toEqual({ from: 'api' });
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('uses custom endpoint', async () => {
httpMock
.scope('https://api.github.example.org')
.get(`${basePath}/default.json`)
.reply(200, {
content: Buffer.from('{"from":"api"}').toString('base64'),
});
expect(
await github
.getPresetFromEndpoint(
'some/repo',
'default',
'https://api.github.example.org'
)
.catch((_) => {});
expect(got.mock.calls[0][0]).toEqual(
'https://api.github.example.org/repos/some/repo/contents/default.json'
);
.catch(() => ({ from: 'api' }))
).toEqual({ from: 'api' });
expect(httpMock.getTrace()).toMatchSnapshot();
});
});
});
......@@ -24,6 +24,7 @@ export async function fetchJSONFile(
try {
res = await http.getJson(url, opts);
} catch (err) {
// istanbul ignore if: not testable with nock
if (err.message === PLATFORM_FAILURE) {
throw err;
}
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`config/presets/gitlab getPreset() should return the preset 1`] = `
exports[`config/presets/gitlab/index getPreset() should return the preset 1`] = `
Array [
Object {
"headers": Object {
......@@ -25,7 +25,7 @@ Array [
]
`;
exports[`config/presets/gitlab getPreset() throws if fails to parse 1`] = `
exports[`config/presets/gitlab/index getPreset() throws if fails to parse 1`] = `
Array [
Object {
"headers": Object {
......@@ -37,10 +37,20 @@ Array [
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/branches",
},
Object {
"headers": Object {
"accept": "application/json",
"accept-encoding": "gzip, deflate",
"host": "gitlab.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=master",
},
]
`;
exports[`config/presets/gitlab getPreset() throws if no content 1`] = `
exports[`config/presets/gitlab/index getPreset() throws if no content 1`] = `
Array [
Object {
"headers": Object {
......@@ -55,7 +65,9 @@ Array [
]
`;
exports[`config/presets/gitlab getPresetFromEndpoint() uses custom endpoint 1`] = `
exports[`config/presets/gitlab/index getPreset() throws if not default 1`] = `Array []`;
exports[`config/presets/gitlab/index getPresetFromEndpoint() uses custom endpoint 1`] = `
Array [
Object {
"headers": Object {
......@@ -75,7 +87,32 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.example.org/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=master",
"url": "https://gitlab.example.org/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=devel",
},
]
`;
exports[`config/presets/gitlab/index getPresetFromEndpoint() uses default endpoint 1`] = `
Array [
Object {
"headers": Object {
"accept": "application/json",
"accept-encoding": "gzip, deflate",
"host": "gitlab.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/branches",
},
Object {
"headers": Object {
"accept": "application/json",
"accept-encoding": "gzip, deflate",
"host": "gitlab.com",
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=devel",
},
]
`;
import * as httpMock from '../../../../test/httpMock';
import { getName } from '../../../../test/util';
import * as gitlab from '.';
const gitlabApiHost = 'https://gitlab.com';
const basePath = '/api/v4/projects/some%2Frepo/repository';
describe('config/presets/gitlab', () => {
describe(getName(__filename), () => {
beforeEach(() => {
httpMock.reset();
jest.resetAllMocks();
httpMock.setup();
});
afterEach(() => {
httpMock.reset();
});
describe('getPreset()', () => {
it('throws if non-default', async () => {
it('throws if no content', async () => {
httpMock.scope(gitlabApiHost).get(`${basePath}/branches`).reply(500, {});
await expect(
gitlab.getPreset({
packageName: 'some/repo',
presetName: 'non-default',
presetName: 'default',
})
).rejects.toThrow();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('throws if no content', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/some%2Frepo/repository/branches')
.reply(200, {});
it('throws if not default', async () => {
await expect(
gitlab.getPreset({ packageName: 'some/repo' })
gitlab.getPreset({
packageName: 'some/repo',
presetName: 'non-default',
})
).rejects.toThrow();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('throws if fails to parse', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/some%2Frepo/repository/branches')
.reply(200, {
content: Buffer.from('not json').toString('base64'),
});
.get(`${basePath}/branches`)
.reply(200, [])
.get(`${basePath}/files/renovate.json?ref=master`)
.reply(200, { content: Buffer.from('not json').toString('base64') });
await expect(
gitlab.getPreset({ packageName: 'some/repo' })
).rejects.toThrow();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('should return the preset', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/some%2Frepo/repository/branches')
.get(`${basePath}/branches`)
.reply(200, [
{
name: 'devel',
......@@ -52,34 +64,59 @@ describe('config/presets/gitlab', () => {
default: true,
},
])
.get(
'/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=master'
)
.reply(200, {
.get(`${basePath}/files/renovate.json?ref=master`)
.reply(
200,
{
content: Buffer.from('{"foo":"bar"}').toString('base64'),
});
},
{}
);
const content = await gitlab.getPreset({ packageName: 'some/repo' });
expect(content).toEqual({ foo: 'bar' });
expect(httpMock.getTrace()).toMatchSnapshot();
});
});
describe('getPresetFromEndpoint()', () => {
it('uses default endpoint', async () => {
httpMock
.scope(gitlabApiHost)
.get(`${basePath}/branches`)
.reply(200, [
{
name: 'devel',
default: true,
},
])
.get(`${basePath}/files/renovate.json?ref=devel`)
.reply(200, { content: Buffer.from('{}').toString('base64') });
expect(
await gitlab.getPresetFromEndpoint('some/repo', 'default')
).toEqual({});
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('uses custom endpoint', async () => {
httpMock
.scope('https://gitlab.example.org')
.get('/api/v4/projects/some%2Frepo/repository/branches')
.reply(200, [])
.get(
'/api/v4/projects/some%2Frepo/repository/files/renovate.json?ref=master'
)
.reply(200, '');
await gitlab
.getPresetFromEndpoint(
.get(`${basePath}/branches`)
.reply(200, [
{
name: 'devel',
default: true,
},
])
.get(`${basePath}/files/renovate.json?ref=devel`)
.reply(404);
await expect(
gitlab.getPresetFromEndpoint(
'some/repo',
'default',
'https://gitlab.example.org/api/v4'
)
.catch((_) => {});
).rejects.toThrow();
expect(httpMock.getTrace()).toMatchSnapshot();
});
});
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`config/presets/local getPreset() forwards to custom github 1`] = `
exports[`config/presets/local/index getPreset() forwards to custom github 1`] = `
Array [
Array [
"some/repo",
"",
"default",
"https://api.github.example.com",
],
]
`;
exports[`config/presets/local getPreset() forwards to custom github 2`] = `
exports[`config/presets/local/index getPreset() forwards to custom github 2`] = `
Object {
"resolved": "preset",
}
`;
exports[`config/presets/local getPreset() forwards to custom gitlab 1`] = `
exports[`config/presets/local/index getPreset() forwards to custom gitlab 1`] = `
Array [
Array [
"some/repo",
"",
"default",
"https://gitlab.example.com/api/v4",
],
]
`;
exports[`config/presets/local getPreset() forwards to custom gitlab 2`] = `
exports[`config/presets/local/index getPreset() forwards to custom gitlab 2`] = `
Object {
"resolved": "preset",
}
`;
exports[`config/presets/local getPreset() forwards to github 1`] = `
exports[`config/presets/local/index getPreset() forwards to github 1`] = `
Array [
Array [
"some/repo",
......@@ -42,23 +42,23 @@ Array [
]
`;
exports[`config/presets/local getPreset() forwards to github 2`] = `
exports[`config/presets/local/index getPreset() forwards to github 2`] = `
Object {
"resolved": "preset",
}
`;
exports[`config/presets/local getPreset() forwards to gitlab 1`] = `
exports[`config/presets/local/index getPreset() forwards to gitlab 1`] = `
Array [
Array [
"some/repo",
"",
"default",
undefined,
],
]
`;
exports[`config/presets/local getPreset() forwards to gitlab 2`] = `
exports[`config/presets/local/index getPreset() forwards to gitlab 2`] = `
Object {
"resolved": "preset",
}
......
import * as github from '../github';
import * as gitlab from '../gitlab';
import { getName, mocked } from '../../../../test/util';
import * as _github from '../github';
import * as _gitlab from '../gitlab';
import * as local from '.';
jest.mock('../gitlab');
jest.mock('../github');
const gitlabGetPreset: jest.Mock<Promise<
any
>> = gitlab.getPresetFromEndpoint as never;
const githubGetPreset: jest.Mock<Promise<
any
>> = github.getPresetFromEndpoint as never;
const gitlab = mocked(_gitlab);
const github = mocked(_github);
describe('config/presets/local', () => {
describe(getName(__filename), () => {
beforeEach(() => {
gitlabGetPreset.mockReset();
gitlabGetPreset.mockResolvedValueOnce({ resolved: 'preset' });
githubGetPreset.mockReset();
githubGetPreset.mockResolvedValueOnce({ resolved: 'preset' });
jest.resetAllMocks();
gitlab.getPresetFromEndpoint.mockResolvedValueOnce({ resolved: 'preset' });
github.getPresetFromEndpoint.mockResolvedValueOnce({ resolved: 'preset' });
});
describe('getPreset()', () => {
it('throws for unsupported platform', async () => {
......@@ -45,24 +41,24 @@ describe('config/presets/local', () => {
it('forwards to gitlab', async () => {
const content = await local.getPreset({
packageName: 'some/repo',
presetName: '',
presetName: 'default',
baseConfig: {
platform: 'GitLab',
},
});
expect(gitlabGetPreset.mock.calls).toMatchSnapshot();
expect(gitlab.getPresetFromEndpoint.mock.calls).toMatchSnapshot();
expect(content).toMatchSnapshot();
});
it('forwards to custom gitlab', async () => {
const content = await local.getPreset({
packageName: 'some/repo',
presetName: '',
presetName: 'default',
baseConfig: {
platform: 'gitlab',
endpoint: 'https://gitlab.example.com/api/v4',
},
});
expect(gitlabGetPreset.mock.calls).toMatchSnapshot();
expect(gitlab.getPresetFromEndpoint.mock.calls).toMatchSnapshot();
expect(content).toMatchSnapshot();
});
......@@ -73,19 +69,19 @@ describe('config/presets/local', () => {
platform: 'github',
},
});
expect(githubGetPreset.mock.calls).toMatchSnapshot();
expect(github.getPresetFromEndpoint.mock.calls).toMatchSnapshot();
expect(content).toMatchSnapshot();
});
it('forwards to custom github', async () => {
const content = await local.getPreset({
packageName: 'some/repo',
presetName: '',
presetName: 'default',
baseConfig: {
platform: 'github',
endpoint: 'https://api.github.example.com',
},
});
expect(githubGetPreset.mock.calls).toMatchSnapshot();
expect(github.getPresetFromEndpoint.mock.calls).toMatchSnapshot();
expect(content).toMatchSnapshot();
});
});
......
......@@ -89,13 +89,22 @@ describe('workers/pr/changelog', () => {
expect(httpMock.getTrace()).toHaveLength(0);
});
it('works without Github', async () => {
httpMock.scope(githubApiHost);
httpMock
.scope(githubApiHost)
.get('/repos/chalk/chalk/tags?per_page=100')
.reply(500)
.get('/repos/chalk/chalk/releases?per_page=100')
.times(4)
.reply(500)
.get('/repos/chalk/chalk/contents/')
.times(4)
.reply(500);
expect(
await getChangeLogJSON({
...upgrade,
})
).toMatchSnapshot();
expect(httpMock.getTrace()).toHaveLength(0);
expect(httpMock.getTrace()).toHaveLength(9);
});
it('uses GitHub tags', async () => {
httpMock
......
......@@ -82,9 +82,13 @@ function simplifyGraphqlAST(tree: any): any {
return tree;
}
function onMissing(_: any, opts: any): void /* istanbul ignore next */ {
function onMissing(req: any, opts: any): void /* istanbul ignore next */ {
if (!opts) {
missingLog.push(` ${req.method} ${req.href}`);
} else {
missingLog.push(` ${opts.method} ${opts.href}`);
}
}
export function setup(): void {
if (!nock.isActive()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment