Skip to content

Commit d6af368

Browse files
authored
test: update mock datasets (#1076)
1 parent a349697 commit d6af368

File tree

10 files changed

+443
-480
lines changed

10 files changed

+443
-480
lines changed

src/__mocks__/mockedData.ts

Lines changed: 196 additions & 251 deletions
Large diffs are not rendered by default.

src/components/Repository.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('components/Repository.tsx', () => {
1515

1616
const props = {
1717
hostname: 'github.com',
18-
repoName: 'manosim/gitify',
18+
repoName: 'gitify-app/notifications-test',
1919
repoNotifications: mockedGitHubNotifications,
2020
};
2121

@@ -45,7 +45,7 @@ describe('components/Repository.tsx', () => {
4545

4646
expect(shell.openExternal).toHaveBeenCalledTimes(1);
4747
expect(shell.openExternal).toHaveBeenCalledWith(
48-
'https://github.com/manosim/notifications-test',
48+
'https://github.com/gitify-app/notifications-test',
4949
);
5050
});
5151

@@ -59,7 +59,7 @@ describe('components/Repository.tsx', () => {
5959
fireEvent.click(screen.getByTitle('Mark Repository as Read'));
6060

6161
expect(markRepoNotifications).toHaveBeenCalledWith(
62-
'manosim/notifications-test',
62+
'gitify-app/notifications-test',
6363
'github.com',
6464
);
6565
});
@@ -74,7 +74,7 @@ describe('components/Repository.tsx', () => {
7474
fireEvent.click(screen.getByTitle('Mark Repository as Done'));
7575

7676
expect(markRepoNotificationsDone).toHaveBeenCalledWith(
77-
'manosim/notifications-test',
77+
'gitify-app/notifications-test',
7878
'github.com',
7979
);
8080
});

src/components/__snapshots__/NotificationRow.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/__snapshots__/Repository.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context/App.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ describe('context/App.tsx', () => {
201201
<button
202202
type="button"
203203
onClick={() =>
204-
markRepoNotifications('manosim/gitify', 'github.com')
204+
markRepoNotifications(
205+
'gitify-app/notifications-test',
206+
'github.com',
207+
)
205208
}
206209
>
207210
Test Case
@@ -218,7 +221,7 @@ describe('context/App.tsx', () => {
218221
expect(markRepoNotificationsMock).toHaveBeenCalledTimes(1);
219222
expect(markRepoNotificationsMock).toHaveBeenCalledWith(
220223
{ enterpriseAccounts: [], token: null, user: null },
221-
'manosim/gitify',
224+
'gitify-app/notifications-test',
222225
'github.com',
223226
);
224227
});

src/hooks/useNotifications.test.ts

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ describe('hooks/useNotifications.ts', () => {
239239
latest_comment_url: null,
240240
},
241241
repository: {
242-
full_name: 'some/repo',
242+
full_name: 'gitify-app/notifications-test',
243243
},
244244
},
245245
{
@@ -251,7 +251,7 @@ describe('hooks/useNotifications.ts', () => {
251251
latest_comment_url: null,
252252
},
253253
repository: {
254-
full_name: 'some/repo',
254+
full_name: 'gitify-app/notifications-test',
255255
},
256256
updated_at: '2024-02-26T00:00:00Z',
257257
},
@@ -260,23 +260,25 @@ describe('hooks/useNotifications.ts', () => {
260260
subject: {
261261
title: 'This is an Issue.',
262262
type: 'Issue',
263-
url: 'https://api.github.com/3',
264-
latest_comment_url: 'https://api.github.com/3/comments',
263+
url: 'https://api.github.com/repos/gitify-app/notifications-test/issues/3',
264+
latest_comment_url:
265+
'https://api.github.com/repos/gitify-app/notifications-test/issues/3/comments',
265266
},
266267
repository: {
267-
full_name: 'some/repo',
268+
full_name: 'gitify-app/notifications-test',
268269
},
269270
},
270271
{
271272
id: 4,
272273
subject: {
273274
title: 'This is a Pull Request.',
274275
type: 'PullRequest',
275-
url: 'https://api.github.com/4',
276-
latest_comment_url: 'https://api.github.com/4/comments',
276+
url: 'https://api.github.com/repos/gitify-app/notifications-test/pulls/4',
277+
latest_comment_url:
278+
'https://api.github.com/repos/gitify-app/notifications-test/issues/4/comments',
277279
},
278280
repository: {
279-
full_name: 'some/repo',
281+
full_name: 'gitify-app/notifications-test',
280282
},
281283
},
282284
{
@@ -288,7 +290,7 @@ describe('hooks/useNotifications.ts', () => {
288290
latest_comment_url: null,
289291
},
290292
repository: {
291-
full_name: 'some/repo',
293+
full_name: 'gitify-app/notifications-test',
292294
},
293295
},
294296
{
@@ -300,7 +302,7 @@ describe('hooks/useNotifications.ts', () => {
300302
latest_comment_url: null,
301303
},
302304
repository: {
303-
full_name: 'some/repo',
305+
full_name: 'gitify-app/notifications-test',
304306
},
305307
},
306308
];
@@ -320,12 +322,12 @@ describe('hooks/useNotifications.ts', () => {
320322
viewerSubscription: 'SUBSCRIBED',
321323
stateReason: null,
322324
isAnswered: true,
323-
url: 'https://github.com/manosim/notifications-test/discussions/612',
325+
url: 'https://github.com/gitify-app/notifications-test/discussions/612',
324326
author: {
325327
login: 'discussion-creator',
326328
url: 'https://github.com/discussion-creator',
327329
avatar_url:
328-
'https://avatars.githubusercontent.com/u/1?v=4',
330+
'https://avatars.githubusercontent.com/u/133795385?s=200&v=4',
329331
type: 'User',
330332
},
331333
comments: {
@@ -352,22 +354,30 @@ describe('hooks/useNotifications.ts', () => {
352354
},
353355
});
354356

355-
nock('https://api.github.com').get('/3').reply(200, {
356-
state: 'closed',
357-
merged: true,
358-
user: mockedNotificationUser,
359-
});
360-
nock('https://api.github.com').get('/3/comments').reply(200, {
361-
user: mockedNotificationUser,
362-
});
363-
nock('https://api.github.com').get('/4').reply(200, {
364-
state: 'closed',
365-
merged: false,
366-
user: mockedNotificationUser,
367-
});
368-
nock('https://api.github.com').get('/4/comments').reply(200, {
369-
user: mockedNotificationUser,
370-
});
357+
nock('https://api.github.com')
358+
.get('/repos/gitify-app/notifications-test/issues/3')
359+
.reply(200, {
360+
state: 'closed',
361+
merged: true,
362+
user: mockedNotificationUser,
363+
});
364+
nock('https://api.github.com')
365+
.get('/repos/gitify-app/notifications-test/issues/3/comments')
366+
.reply(200, {
367+
user: mockedNotificationUser,
368+
});
369+
nock('https://api.github.com')
370+
.get('/repos/gitify-app/notifications-test/pulls/4')
371+
.reply(200, {
372+
state: 'closed',
373+
merged: false,
374+
user: mockedNotificationUser,
375+
});
376+
nock('https://api.github.com')
377+
.get('/repos/gitify-app/notifications-test/issues/4/comments')
378+
.reply(200, {
379+
user: mockedNotificationUser,
380+
});
371381

372382
const { result } = renderHook(() => useNotifications());
373383

@@ -403,23 +413,23 @@ describe('hooks/useNotifications.ts', () => {
403413
subject: {
404414
title: 'This is an Issue.',
405415
type: 'Issue',
406-
url: 'https://api.github.com/1',
416+
url: 'https://api.github.com/repos/gitify-app/notifications-test/issues/1',
407417
latest_comment_url: null,
408418
},
409419
repository: {
410-
full_name: 'some/repo',
420+
full_name: 'gitify-app/notifications-test',
411421
},
412422
},
413423
{
414424
id: 2,
415425
subject: {
416426
title: 'This is a Pull Request.',
417427
type: 'PullRequest',
418-
url: 'https://api.github.com/2',
428+
url: 'https://api.github.com/repos/gitify-app/notifications-test/pulls/2',
419429
latest_comment_url: null,
420430
},
421431
repository: {
422-
full_name: 'some/repo',
432+
full_name: 'gitify-app/notifications-test',
423433
},
424434
},
425435
];
@@ -428,7 +438,7 @@ describe('hooks/useNotifications.ts', () => {
428438
.get('/notifications?participating=false')
429439
.reply(200, notifications);
430440
nock('https://api.github.com')
431-
.get('/1')
441+
.get('/repos/gitify-app/notifications-test/issues/1')
432442
.reply(200, {
433443
state: 'closed',
434444
merged: true,
@@ -438,7 +448,7 @@ describe('hooks/useNotifications.ts', () => {
438448
},
439449
});
440450
nock('https://api.github.com')
441-
.get('/2')
451+
.get('/repos/gitify-app/notifications-test/pulls/2')
442452
.reply(200, {
443453
state: 'closed',
444454
merged: false,
@@ -789,7 +799,7 @@ describe('hooks/useNotifications.ts', () => {
789799
});
790800

791801
describe('markRepoNotifications', () => {
792-
const repoSlug = 'manosim/gitify';
802+
const repoSlug = 'gitify-app/notifications-test';
793803

794804
describe('github.com', () => {
795805
const accounts = { ...mockAccounts, enterpriseAccounts: [] };
@@ -875,7 +885,7 @@ describe('hooks/useNotifications.ts', () => {
875885
});
876886

877887
describe('markRepoNotificationsDone', () => {
878-
const repoSlug = 'manosim/gitify';
888+
const repoSlug = 'gitify-app/notifications-test';
879889
const id = 'notification-123';
880890

881891
describe('github.com', () => {

0 commit comments

Comments
 (0)