Skip to content

Commit e7b87dd

Browse files
committed
'when autoclose is disabled' test
1 parent 46179b3 commit e7b87dd

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

__tests__/main.test.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,72 @@ test('successfully runs the action', async () => {
172172
)
173173
})
174174

175+
176+
test('successfully runs the action when autoclose is disabled', async () => {
177+
process.env.INPUT_REVIEW_REQUIRED = 'true'
178+
process.env.INPUT_AUTOCLOSE = 'false'
179+
expect(await run()).toBe('success')
180+
expect(infoMock).toHaveBeenCalledWith('Pull for branch: dependabot-1')
181+
expect(infoMock).toHaveBeenCalledWith('Branch matched prefix: dependabot-1')
182+
expect(infoMock).toHaveBeenCalledWith('Checking green status: dependabot-1')
183+
expect(infoMock).toHaveBeenCalledWith('Validating status: SUCCESS')
184+
expect(infoMock).toHaveBeenCalledWith('Validating review decision: APPROVED')
185+
expect(infoMock).toHaveBeenCalledWith('Branch dependabot-1 is approved')
186+
expect(infoMock).toHaveBeenCalledWith('Pull for branch: dependabot-2')
187+
expect(infoMock).toHaveBeenCalledWith('Branch matched prefix: dependabot-2')
188+
expect(infoMock).toHaveBeenCalledWith('Checking green status: dependabot-2')
189+
expect(infoMock).toHaveBeenCalledWith('Validating status: SUCCESS')
190+
expect(infoMock).toHaveBeenCalledWith('Validating review decision: APPROVED')
191+
expect(infoMock).toHaveBeenCalledWith('Branch dependabot-2 is approved')
192+
expect(infoMock).toHaveBeenCalledWith('Pull for branch: dependabot-3')
193+
expect(infoMock).toHaveBeenCalledWith('Branch matched prefix: dependabot-3')
194+
expect(infoMock).toHaveBeenCalledWith('Pull for branch: dependabot-4')
195+
expect(infoMock).toHaveBeenCalledWith('Branch matched prefix: dependabot-4')
196+
expect(infoMock).toHaveBeenCalledWith('Checking green status: dependabot-4')
197+
expect(infoMock).toHaveBeenCalledWith('Validating status: FAILURE')
198+
expect(infoMock).toHaveBeenCalledWith(
199+
'Discarding dependabot-4 with status FAILURE'
200+
)
201+
expect(infoMock).toHaveBeenCalledWith('Branch matched prefix: dependabot-5')
202+
expect(infoMock).toHaveBeenCalledWith('Checking green status: dependabot-5')
203+
expect(infoMock).toHaveBeenCalledWith('Validating status: SUCCESS')
204+
expect(infoMock).toHaveBeenCalledWith('Validating review decision: null')
205+
expect(infoMock).toHaveBeenCalledWith(
206+
'Branch dependabot-5 has no required reviewers - OK'
207+
)
208+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-1')
209+
expect(infoMock).toHaveBeenCalledWith('Checking ignore_label for: question')
210+
expect(infoMock).toHaveBeenCalledWith('Adding branch to array: dependabot-1')
211+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-2')
212+
expect(infoMock).toHaveBeenCalledWith('Adding branch to array: dependabot-2')
213+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-3')
214+
expect(infoMock).toHaveBeenCalledWith('Checking ignore_label for: nocombine')
215+
expect(infoMock).toHaveBeenCalledWith(
216+
'Discarding dependabot-3 with label nocombine because it matches ignore_label'
217+
)
218+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-4')
219+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-5')
220+
expect(infoMock).toHaveBeenCalledWith('Checking labels: dependabot-6')
221+
expect(infoMock).toHaveBeenCalledWith('Merged branch dependabot-1')
222+
expect(warningMock).toHaveBeenCalledWith(
223+
'Failed to merge branch dependabot-2'
224+
)
225+
expect(infoMock).toHaveBeenCalledWith('Merged branch dependabot-5')
226+
expect(infoMock).toHaveBeenCalledWith('Creating combined PR')
227+
expect(debugMock).toHaveBeenCalledWith(
228+
'PR body: # Combined PRs ➡️📦⬅️\n\n✅ The following pull requests have been successfully combined on this PR:\n- #1 Update dependency 1\n- #5 Update dependency 5\n\n⚠️ The following PRs were left out due to merge conflicts:\n- #2 Update dependency 2\n\n> This PR was created by the [`github/combine-prs`](https://github.com/github/combine-prs) action'
229+
)
230+
expect(infoMock).toHaveBeenCalledWith(
231+
'Combined PR url: https://github.com/test-owner/test-repo/pull/100'
232+
)
233+
expect(infoMock).toHaveBeenCalledWith('Combined PR number: 100')
234+
expect(setOutputMock).toHaveBeenCalledWith('pr_number', 100)
235+
expect(setOutputMock).toHaveBeenCalledWith(
236+
'pr_url',
237+
'https://github.com/test-owner/test-repo/pull/100'
238+
)
239+
})
240+
175241
test('successfully runs the action with the branch_regex option', async () => {
176242
process.env.INPUT_REVIEW_REQUIRED = 'true'
177243
process.env.INPUT_BRANCH_REGEX = '.*penda.*' // match dependabot branches

0 commit comments

Comments
 (0)