Skip to content

Commit 3893b9c

Browse files
authored
refactor: use nodes shorthand in graphql queries (#860)
1 parent 24887d6 commit 3893b9c

File tree

5 files changed

+257
-334
lines changed

5 files changed

+257
-334
lines changed

src/__mocks__/mockedData.ts

+131-179
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Repository,
55
User,
66
GraphQLSearch,
7-
DiscussionSearchResultEdge,
7+
DiscussionSearchResultNode,
88
} from '../typesGithub';
99

1010
export const mockedEnterpriseAccounts: EnterpriseAccount[] = [
@@ -282,214 +282,166 @@ export const mockedSingleAccountNotifications: AccountNotifications[] = [
282282
},
283283
];
284284

285-
export const mockedGraphQLResponse: GraphQLSearch<DiscussionSearchResultEdge> =
285+
export const mockedGraphQLResponse: GraphQLSearch<DiscussionSearchResultNode> =
286286
{
287287
data: {
288288
data: {
289289
search: {
290-
edges: [
290+
nodes: [
291291
{
292-
node: {
293-
viewerSubscription: 'SUBSCRIBED',
294-
title: '1.16.0',
295-
url: 'https://github.com/manosim/notifications-test/discussions/612',
296-
comments: {
297-
edges: [
298-
{
299-
node: {
300-
databaseId: 2215656,
301-
createdAt: '2022-02-20T18:33:39Z',
302-
replies: {
303-
edges: [],
304-
},
305-
},
292+
viewerSubscription: 'SUBSCRIBED',
293+
title: '1.16.0',
294+
url: 'https://github.com/manosim/notifications-test/discussions/612',
295+
comments: {
296+
nodes: [
297+
{
298+
databaseId: 2215656,
299+
createdAt: '2022-02-20T18:33:39Z',
300+
replies: {
301+
nodes: [],
306302
},
307-
{
308-
node: {
309-
databaseId: 2217789,
310-
createdAt: '2022-02-21T03:30:42Z',
311-
replies: {
312-
edges: [],
313-
},
314-
},
303+
},
304+
{
305+
databaseId: 2217789,
306+
createdAt: '2022-02-21T03:30:42Z',
307+
replies: {
308+
nodes: [],
315309
},
316-
{
317-
node: {
318-
databaseId: 2223243,
319-
createdAt: '2022-02-21T18:26:27Z',
320-
replies: {
321-
edges: [
322-
{
323-
node: {
324-
databaseId: 2232922,
325-
createdAt: '2022-02-23T00:57:58Z',
326-
},
327-
},
328-
],
310+
},
311+
{
312+
databaseId: 2223243,
313+
createdAt: '2022-02-21T18:26:27Z',
314+
replies: {
315+
nodes: [
316+
{
317+
databaseId: 2232922,
318+
createdAt: '2022-02-23T00:57:58Z',
329319
},
330-
},
320+
],
331321
},
332-
{
333-
node: {
334-
databaseId: 2232921,
335-
createdAt: '2022-02-23T00:57:49Z',
336-
replies: {
337-
edges: [],
338-
},
339-
},
322+
},
323+
{
324+
databaseId: 2232921,
325+
createdAt: '2022-02-23T00:57:49Z',
326+
replies: {
327+
nodes: [],
340328
},
341-
{
342-
node: {
343-
databaseId: 2258799,
344-
createdAt: '2022-02-27T01:22:20Z',
345-
replies: {
346-
edges: [
347-
{
348-
node: {
349-
databaseId: 2300902,
350-
createdAt: '2022-03-05T17:43:52Z',
351-
},
352-
},
353-
],
329+
},
330+
{
331+
databaseId: 2258799,
332+
createdAt: '2022-02-27T01:22:20Z',
333+
replies: {
334+
nodes: [
335+
{
336+
databaseId: 2300902,
337+
createdAt: '2022-03-05T17:43:52Z',
354338
},
355-
},
339+
],
356340
},
357-
{
358-
node: {
359-
databaseId: 2297637,
360-
createdAt: '2022-03-04T20:39:44Z',
361-
replies: {
362-
edges: [
363-
{
364-
node: {
365-
databaseId: 2300893,
366-
createdAt: '2022-03-05T17:41:04Z',
367-
},
368-
},
369-
],
341+
},
342+
{
343+
databaseId: 2297637,
344+
createdAt: '2022-03-04T20:39:44Z',
345+
replies: {
346+
nodes: [
347+
{
348+
databaseId: 2300893,
349+
createdAt: '2022-03-05T17:41:04Z',
370350
},
371-
},
351+
],
372352
},
373-
{
374-
node: {
375-
databaseId: 2299763,
376-
createdAt: '2022-03-05T11:05:42Z',
377-
replies: {
378-
edges: [
379-
{
380-
node: {
381-
databaseId: 2300895,
382-
createdAt: '2022-03-05T17:41:44Z',
383-
},
384-
},
385-
],
353+
},
354+
{
355+
databaseId: 2299763,
356+
createdAt: '2022-03-05T11:05:42Z',
357+
replies: {
358+
nodes: [
359+
{
360+
databaseId: 2300895,
361+
createdAt: '2022-03-05T17:41:44Z',
386362
},
387-
},
363+
],
388364
},
389-
],
390-
},
365+
},
366+
],
391367
},
392368
},
393369
{
394-
node: {
395-
viewerSubscription: 'IGNORED',
396-
title: '1.16.0',
397-
url: 'https://github.com/manosim/notifications-test/discussions/612',
398-
comments: {
399-
edges: [
400-
{
401-
node: {
402-
databaseId: 2215656,
403-
createdAt: '2022-02-20T18:33:39Z',
404-
replies: {
405-
edges: [],
406-
},
407-
},
370+
viewerSubscription: 'IGNORED',
371+
title: '1.16.0',
372+
url: 'https://github.com/manosim/notifications-test/discussions/612',
373+
comments: {
374+
nodes: [
375+
{
376+
databaseId: 2215656,
377+
createdAt: '2022-02-20T18:33:39Z',
378+
replies: {
379+
nodes: [],
408380
},
409-
{
410-
node: {
411-
databaseId: 2217789,
412-
createdAt: '2022-02-21T03:30:42Z',
413-
replies: {
414-
edges: [],
415-
},
416-
},
381+
},
382+
{
383+
databaseId: 2217789,
384+
createdAt: '2022-02-21T03:30:42Z',
385+
replies: {
386+
nodes: [],
417387
},
418-
{
419-
node: {
420-
databaseId: 2223243,
421-
createdAt: '2022-02-21T18:26:27Z',
422-
replies: {
423-
edges: [
424-
{
425-
node: {
426-
databaseId: 2232922,
427-
createdAt: '2022-02-23T00:57:58Z',
428-
},
429-
},
430-
],
388+
},
389+
{
390+
databaseId: 2223243,
391+
createdAt: '2022-02-21T18:26:27Z',
392+
replies: {
393+
nodes: [
394+
{
395+
databaseId: 2232922,
396+
createdAt: '2022-02-23T00:57:58Z',
431397
},
432-
},
398+
],
433399
},
434-
{
435-
node: {
436-
databaseId: 2232921,
437-
createdAt: '2022-02-23T00:57:49Z',
438-
replies: {
439-
edges: [],
440-
},
441-
},
400+
},
401+
{
402+
databaseId: 2232921,
403+
createdAt: '2022-02-23T00:57:49Z',
404+
replies: {
405+
nodes: [],
442406
},
443-
{
444-
node: {
445-
databaseId: 2258799,
446-
createdAt: '2022-02-27T01:22:20Z',
447-
replies: {
448-
edges: [
449-
{
450-
node: {
451-
databaseId: 2300902,
452-
createdAt: '2022-03-05T17:43:52Z',
453-
},
454-
},
455-
],
407+
},
408+
{
409+
databaseId: 2258799,
410+
createdAt: '2022-02-27T01:22:20Z',
411+
replies: {
412+
nodes: [
413+
{
414+
databaseId: 2300902,
415+
createdAt: '2022-03-05T17:43:52Z',
456416
},
457-
},
417+
],
458418
},
459-
{
460-
node: {
461-
databaseId: 2297637,
462-
createdAt: '2022-03-04T20:39:44Z',
463-
replies: {
464-
edges: [
465-
{
466-
node: {
467-
databaseId: 2300893,
468-
createdAt: '2022-03-05T17:41:04Z',
469-
},
470-
},
471-
],
419+
},
420+
{
421+
databaseId: 2297637,
422+
createdAt: '2022-03-04T20:39:44Z',
423+
replies: {
424+
nodes: [
425+
{
426+
databaseId: 2300893,
427+
createdAt: '2022-03-05T17:41:04Z',
472428
},
473-
},
429+
],
474430
},
475-
{
476-
node: {
477-
databaseId: 2299763,
478-
createdAt: '2022-03-05T11:05:42Z',
479-
replies: {
480-
edges: [
481-
{
482-
node: {
483-
databaseId: 2300895,
484-
createdAt: '2022-03-05T17:41:44Z',
485-
},
486-
},
487-
],
431+
},
432+
{
433+
databaseId: 2299763,
434+
createdAt: '2022-03-05T11:05:42Z',
435+
replies: {
436+
nodes: [
437+
{
438+
databaseId: 2300895,
439+
createdAt: '2022-03-05T17:41:44Z',
488440
},
489-
},
441+
],
490442
},
491-
],
492-
},
443+
},
444+
],
493445
},
494446
},
495447
],

0 commit comments

Comments
 (0)