/
config-description.spec.ts
101 lines (86 loc) · 2.65 KB
/
config-description.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import type { BranchConfig } from '../../../../types';
import { getPrConfigDescription } from './config-description';
describe('workers/repository/update/pr/body/config-description', () => {
describe('getPrConfigDescription', () => {
const config: BranchConfig = {
manager: 'some-manager',
baseBranch: 'base',
branchName: 'some-branch',
upgrades: [],
};
beforeEach(() => {
jest.resetAllMocks();
});
it('renders stopUpdating=true', () => {
const res = getPrConfigDescription({
...config,
stopUpdating: true,
});
expect(res).toContain(
`**Rebasing**: Never, or you tick the rebase/retry checkbox.`
);
});
it('renders rebaseWhen="never"', () => {
const res = getPrConfigDescription({
...config,
rebaseWhen: 'never',
});
expect(res).toContain(
`**Rebasing**: Never, or you tick the rebase/retry checkbox.`
);
});
it('renders rebaseWhen="behind-base-branch"', () => {
const res = getPrConfigDescription({
...config,
rebaseWhen: 'behind-base-branch',
});
expect(res).toContain(`Whenever PR is behind base branch`);
});
it('renders timezone', () => {
const res = getPrConfigDescription({
...config,
schedule: ['* 1 * * * *'],
timezone: 'Europe/Istanbul',
});
expect(res).toContain(`in timezone Europe/Istanbul`);
});
it('renders UTC as the default timezone', () => {
const res = getPrConfigDescription({
...config,
schedule: ['* 1 * * * *'],
});
expect(res).toContain(`"* 1 * * * *" (UTC)`);
});
it('renders undefined schedule', () => {
const res = getPrConfigDescription(config);
expect(res).toContain(`At any time (no schedule defined).`);
});
it('renders recreateClosed', () => {
const res = getPrConfigDescription({
...config,
recreateClosed: true,
});
expect(res).toContain(`**Immortal**`);
});
it('renders singular', () => {
const res = getPrConfigDescription({
...config,
upgrades: [config],
});
expect(res).toContain(`this update`);
});
it('renders automerge', () => {
const res = getPrConfigDescription({ ...config, automerge: true });
expect(res).toContain(`**Automerge**: Enabled.`);
});
it('renders blocked automerge', () => {
const res = getPrConfigDescription({
...config,
automergedPreviously: true,
});
expect(res).toContain(
`**Automerge**: Disabled because a matching PR was automerged previously.`
);
});
});
});