Skip to content

Commit

Permalink
refactor: Sample util coverage (#22997)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Jun 27, 2023
1 parent 4eb11d1 commit 124d1c5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/util/index.spec.ts → lib/util/sample.spec.ts
@@ -1,11 +1,12 @@
import { sampleSize } from '.';
import { sampleSize } from './sample';

describe('util/index', () => {
describe('util/sample', () => {
describe('sampleSize', () => {
const array = ['a', 'b', 'c', 'd'];

it('returns correct sized array', () => {
expect(sampleSize(array, 2)).toHaveLength(2);
expect(sampleSize(array, 10)).toHaveLength(4);
});

it('returns full array for undefined number', () => {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/workers/repository/update/pr/participants.spec.ts
Expand Up @@ -2,11 +2,11 @@ import { mocked, partial, platform } from '../../../../../test/util';
import { GlobalConfig } from '../../../../config/global';
import type { RenovateConfig } from '../../../../config/types';
import type { Pr } from '../../../../modules/platform/types';
import * as _util from '../../../../util';
import * as _util from '../../../../util/sample';
import * as _codeOwners from './code-owners';
import { addParticipants } from './participants';

jest.mock('../../../../util');
jest.mock('../../../../util/sample');
const util = mocked(_util);

jest.mock('./code-owners');
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/update/pr/participants.ts
Expand Up @@ -3,7 +3,7 @@ import { GlobalConfig } from '../../../../config/global';
import type { RenovateConfig } from '../../../../config/types';
import { logger } from '../../../../logger';
import { Pr, platform } from '../../../../modules/platform';
import { sampleSize } from '../../../../util';
import { sampleSize } from '../../../../util/sample';
import { codeOwnersForPr } from './code-owners';

async function addCodeOwners(
Expand Down

0 comments on commit 124d1c5

Please sign in to comment.