Skip to content

Commit

Permalink
test(platform): add test that hostRules are passed through initPlatfo…
Browse files Browse the repository at this point in the history
…rm() (#19491)
  • Loading branch information
Shegox committed Dec 20, 2022
1 parent 0fd5392 commit 3ec3c1e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions lib/modules/platform/index.spec.ts
Expand Up @@ -76,4 +76,45 @@ describe('modules/platform/index', () => {
platform: 'bitbucket',
});
});

it('merges config hostRules with platform hostRules', async () => {
httpMock.scope('https://ghe.renovatebot.com').head('/').reply(200);

const config = {
platform: 'github' as PlatformId,
endpoint: 'https://ghe.renovatebot.com',
gitAuthor: 'user@domain.com',
username: 'abc',
token: '123',
hostRules: [
{
hostType: 'github',
matchHost: 'github.com',
token: '456',
username: 'def',
},
],
};

expect(await platform.initPlatform(config)).toEqual({
endpoint: 'https://ghe.renovatebot.com/',
gitAuthor: 'user@domain.com',
hostRules: [
{
hostType: 'github',
matchHost: 'github.com',
token: '456',
username: 'def',
},
{
hostType: 'github',
matchHost: 'ghe.renovatebot.com',
token: '123',
username: 'abc',
},
],
platform: 'github',
renovateUsername: 'abc',
});
});
});

0 comments on commit 3ec3c1e

Please sign in to comment.