/
index.spec.ts
30 lines (27 loc) · 959 Bytes
/
index.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 },
]);
});
});