mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-24 22:48:06 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
32 lines
993 B
TypeScript
32 lines
993 B
TypeScript
import { getApiBaseUrl, getSourceUrlBase } from './url.ts';
|
|
|
|
describe('util/github/url', () => {
|
|
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/',
|
|
);
|
|
});
|
|
});
|
|
});
|