0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/util/http/jira.spec.ts
2023-11-07 15:50:29 +00:00

28 lines
736 B
TypeScript

import * as httpMock from '../../../test/http-mock';
import { JiraHttp, setBaseUrl } from './jira';
describe('util/http/jira', () => {
const api = new JiraHttp();
it('throws error if setBaseUrl not called', async () => {
await expect(api.postJson('some-path')).rejects.toThrow(
new TypeError('Invalid URL'),
);
});
it('accepts custom baseUrl', async () => {
const siteUrl = 'https://some-site.atlassian.com';
httpMock.scope(siteUrl).post('/some-path').reply(200, {});
setBaseUrl(siteUrl);
expect(await api.postJson('some-path')).toEqual({
authorization: false,
body: {},
headers: {
'content-type': 'application/json',
},
statusCode: 200,
});
});
});