Skip to content

Commit c476e63

Browse files
committed
test: adjust unit test of get pulls list
1 parent 1056737 commit c476e63

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/__test__/get-pulls-list.spec.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ const getPullsListByBranch = require('../get-pulls-list')
88

99
describe('getPullsListByBranch', () => {
1010
let params = {}
11+
let pullRequestValues = {
12+
title: 'Pull request title',
13+
body: 'Pull request body'
14+
}
1115

1216
beforeAll(() => {
1317
jest.spyOn(core, 'info').mockImplementation(jest.fn())
@@ -16,26 +20,23 @@ describe('getPullsListByBranch', () => {
1620
params = {
1721
head: 'main',
1822
base: 'develop',
19-
body: 'some-body',
2023
repo: 'some-repo',
2124
owner: 'some-owner',
22-
title: 'some-title',
25+
body: 'Pull request body',
26+
title: 'Pull request title',
2327
}
2428
})
2529

2630
afterAll(() => {
2731
jest.restoreAllMocks()
2832
})
2933

30-
test('Get already opened pull request', async () => {
31-
const data = await getPullsListByBranch(octokit, params)
32-
const expectedValue = {
33-
state: "open",
34-
title: "Amazing new feature",
35-
url: "https://api.github.com/repos/octocat/Hello-World/pulls/134",
36-
number: 134,
37-
}
34+
test('When there is no open sync pull request', async () => {
35+
const data = await getPullsListByBranch(octokit, {
36+
pullRequestValues,
37+
params
38+
})
3839

39-
expect(data).toEqual(expectedValue)
40+
expect(data).toEqual(false)
4041
})
4142
})

0 commit comments

Comments
 (0)