Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Jan 11, 2025
1 parent f36cc16 commit 0a24653
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/workers/repository/init/inherited.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mocked, platform } from '../../../../test/util';
import { hostRules, mocked, platform } from '../../../../test/util';
import * as presets_ from '../../../config/presets';
import type { RenovateConfig } from '../../../config/types';
import * as validation from '../../../config/validation';
Expand Down Expand Up @@ -91,6 +91,27 @@ describe('workers/repository/init/inherited', () => {
expect(logger.warn).not.toHaveBeenCalled();
});

it('should set hostRules from inherited config', async () => {
platform.getRawFile.mockResolvedValue(
`{
"hostRules": [
{
"matchHost": "some-host-url",
"token": "some-token"
}
]
}`,
);
const res = await mergeInheritedConfig(config);
expect(hostRules.getAll()).toMatchObject([
{
matchHost: 'some-host-url',
token: 'some-token',
},
]);
expect(res.hostRules).toBeUndefined();
});

it('should resolve presets found in inherited config', async () => {
platform.getRawFile.mockResolvedValue(
'{"onboarding":false,"labels":["test"],"extends":[":automergeAll"]}',
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/init/inherited.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function setInheritedHostRules(config: RenovateConfig): void {
try {
hostRules.add(rule);
} catch (err) {
// istanbul ignore next
logger.warn(
{ err, config: rule },
'Error setting hostRule from config',
Expand Down

0 comments on commit 0a24653

Please sign in to comment.