Skip to content

Commit

Permalink
test: fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Jul 21, 2022
1 parent 1e16ad2 commit 760a97f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/workers/global/config/parse/env.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ describe('workers/global/config/parse/env', () => {
RENOVATE_DRY_RUN: 'false',
};
const config = env.getConfig(envParam);
expect(config.dryRun).toBeNull();
expect(config.dryRun).toBeUndefined();
});

it('dryRun null', () => {
const envParam: NodeJS.ProcessEnv = {
RENOVATE_DRY_RUN: 'null',
};
const config = env.getConfig(envParam);
expect(config.dryRun).toBeNull();
expect(config.dryRun).toBeUndefined();
});

it('requireConfig boolean true', () => {
Expand Down
10 changes: 8 additions & 2 deletions lib/workers/global/initialize.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { git } from '../../../test/util';
import { git, mockedFunction } from '../../../test/util';
import type { AllConfig, RenovateConfig } from '../../config/types';
import { initPlatform as _initPlatform } from '../../modules/platform';
import { globalInitialize } from './initialize';

jest.mock('../../util/git');
const initPlatform = mockedFunction(_initPlatform);

describe('workers/global/initialize', () => {
beforeEach(() => {
initPlatform.mockImplementationOnce((r) => Promise.resolve(r));
});

describe('checkVersions()', () => {
it('throws if invalid version', async () => {
const config: RenovateConfig = {};
Expand All @@ -13,7 +19,7 @@ describe('workers/global/initialize', () => {
});

it('returns if valid git version', async () => {
const config: RenovateConfig = {};
const config: RenovateConfig = { prCommitsPerRunLimit: 2 };
git.validateGitVersion.mockResolvedValueOnce(true);
await expect(globalInitialize(config)).toResolve();
});
Expand Down

0 comments on commit 760a97f

Please sign in to comment.