Skip to content

Commit 64e104b

Browse files
committed
feat(pr): support github merge queue
Signed-off-by: Adam Setch <[email protected]>
1 parent 174b619 commit 64e104b

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/renderer/utils/notifications/handlers/pullRequest.test.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,45 @@ describe('renderer/utils/notifications/handlers/pullRequest.ts', () => {
122122
} as GitifySubject);
123123
});
124124

125+
it('merge queue pull request state', async () => {
126+
const mockPullRequest = mockPullRequestResponseNode({
127+
state: 'OPEN',
128+
isInMergeQueue: true,
129+
});
130+
131+
nock('https://api.github.com')
132+
.post('/graphql')
133+
.reply(200, {
134+
data: {
135+
repository: {
136+
pullRequest: mockPullRequest,
137+
},
138+
},
139+
});
140+
141+
const result = await pullRequestHandler.enrich(
142+
mockNotification,
143+
mockSettings,
144+
);
145+
146+
expect(result).toEqual({
147+
number: 123,
148+
state: 'MERGE_QUEUE',
149+
user: {
150+
login: mockAuthor.login,
151+
html_url: mockAuthor.html_url,
152+
avatar_url: mockAuthor.avatar_url,
153+
type: mockAuthor.type,
154+
},
155+
reviews: null,
156+
labels: [],
157+
linkedIssues: [],
158+
comments: 0,
159+
milestone: null,
160+
htmlUrl: 'https://github.com/gitify-app/notifications-test/pulls/123',
161+
} as GitifySubject);
162+
});
163+
125164
it('merged pull request state', async () => {
126165
const mockPullRequest = mockPullRequestResponseNode({
127166
state: 'MERGED',
@@ -447,6 +486,7 @@ function mockPullRequestResponseNode(mocks: {
447486
state: PullRequestState;
448487
isDraft?: boolean;
449488
merged?: boolean;
489+
isInMergeQueue?: boolean;
450490
}): PullRequestResponse {
451491
return {
452492
__typename: 'PullRequest',
@@ -455,7 +495,7 @@ function mockPullRequestResponseNode(mocks: {
455495
state: mocks.state,
456496
isDraft: mocks.isDraft ?? false,
457497
merged: mocks.merged ?? false,
458-
isInMergeQueue: false,
498+
isInMergeQueue: mocks.isInMergeQueue ?? false,
459499
url: 'https://github.com/gitify-app/notifications-test/pulls/123',
460500
author: mockAuthor,
461501
labels: { nodes: [] },

0 commit comments

Comments
 (0)