0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-27 05:09:37 +00:00
renovatebot_renovate/lib/workers/repository/changelog/index.spec.ts
RahulGautamSingh c2d3ca856f feat(release-notes)!: support configurable fetching stage (#22781)
Changes fetchReleaseNotes from boolean to enum, with values off, branch, pr.

Closes #20476

BREAKING CHANGE: Release notes won't be fetched early for commitBody insertion unless explicitly configured with fetchReleaseNotes=branch
2023-07-04 19:21:52 +02:00

30 lines
959 B
TypeScript

import { mockedFunction, partial } from '../../../../test/util';
import type { BranchUpgradeConfig } from '../../types';
import { getChangeLogJSON } from '../update/pr/changelog';
import { embedChangelogs } from '.';
jest.mock('../update/pr/changelog');
mockedFunction(getChangeLogJSON).mockResolvedValue({
hasReleaseNotes: true,
});
describe('workers/repository/changelog/index', () => {
it('embedChangelogs', async () => {
mockedFunction(getChangeLogJSON).mockResolvedValueOnce({
hasReleaseNotes: true,
});
mockedFunction(getChangeLogJSON).mockResolvedValueOnce(null);
const branches = [
partial<BranchUpgradeConfig>({ logJSON: null }),
partial<BranchUpgradeConfig>(),
partial<BranchUpgradeConfig>(),
];
await expect(embedChangelogs(branches)).toResolve();
expect(branches).toEqual([
{ logJSON: null },
{ logJSON: { hasReleaseNotes: true } },
{ logJSON: null },
]);
});
});