Files
renovate/lib/modules/datasource/github-releases/common.spec.ts
T
RahulGautamSingh 93dd940574 refactor(modules/datasource): fix null-check issues (#16153)
* fix null-check issues

* Update index.spec.ts

* apply suggestion from review

* fix coverage issue

* Update index.spec.ts

* Apply suggestions from code review

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

* Update datasource.spec.ts

* Update lib/modules/datasource/conan/index.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

* Update datasource.spec.ts

* fix null-check issue

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-20 16:24:37 +02:00

32 lines
1017 B
TypeScript

import { getApiBaseUrl, getSourceUrlBase } from './common';
describe('modules/datasource/github-releases/common', () => {
describe('getSourceUrlBase', () => {
it('ensures trailing slash', () => {
const sourceUrl = getSourceUrlBase('https://gh.my-company.com');
expect(sourceUrl).toBe('https://gh.my-company.com/');
});
it('defaults to github.com', () => {
const sourceUrl = getSourceUrlBase(undefined);
expect(sourceUrl).toBe('https://github.com/');
});
});
describe('getApiBaseUrl', () => {
it('maps to api.github.com', () => {
const apiUrl = getApiBaseUrl('https://github.com/');
expect(apiUrl).toBe('https://api.github.com/');
});
it('supports local github installations', () => {
expect(getApiBaseUrl('https://gh.my-company.com/')).toBe(
'https://gh.my-company.com/api/v3/'
);
expect(getApiBaseUrl('https://gh.my-company.com/api/v3/')).toBe(
'https://gh.my-company.com/api/v3/'
);
});
});
});