Repository: gitify-app/gitify (ts)

Issue:
refactor GraphQL query shape to use `nodes` shorthand
### 📝 Provide a description of the new feature

Currently we are querying for the relay paginated shape (`edges` -> `node`).  We don't do anything currently with the edge information, so we can simplify our shape by going directly to `nodes`.

### ➕ Additional Information

_No response_

Pull request description:
refactor: use nodes shorthand in graphql queries
Closes #831

Since we aren't using any of the relay paginated information in the GraphQL search responses, we can simplify and use the `nodes` shorthand

Patch:
diff --git a/src/__mocks__/mockedData.ts b/src/__mocks__/mockedData.ts
index cfa1ef9b..3fedecff 100644
--- a/src/__mocks__/mockedData.ts
+++ b/src/__mocks__/mockedData.ts
@@ -4,7 +4,7 @@ import {
   Repository,
   User,
   GraphQLSearch,
-  DiscussionSearchResultEdge,
+  DiscussionSearchResultNode,
 } from '../typesGithub';
 
 export const mockedEnterpriseAccounts: EnterpriseAccount[] = [
@@ -282,214 +282,166 @@ export const mockedSingleAccountNotifications: AccountNotifications[] = [
   },
 ];
 
-export const mockedGraphQLResponse: GraphQLSearch<DiscussionSearchResultEdge> =
+export const mockedGraphQLResponse: GraphQLSearch<DiscussionSearchResultNode> =
   {
     data: {
       data: {
         search: {
-          edges: [
+          nodes: [
             {
-              node: {
-                viewerSubscription: 'SUBSCRIBED',
-                title: '1.16.0',
-                url: 'https://github.com/manosim/notifications-test/discussions/612',
-                comments: {
-                  edges: [
-                    {
-                      node: {
-                        databaseId: 2215656,
-                        createdAt: '2022-02-20T18:33:39Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+              viewerSubscription: 'SUBSCRIBED',
+              title: '1.16.0',
+              url: 'https://github.com/manosim/notifications-test/discussions/612',
+              comments: {
+                nodes: [
+                  {
+                    databaseId: 2215656,
+                    createdAt: '2022-02-20T18:33:39Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2217789,
-                        createdAt: '2022-02-21T03:30:42Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+                  },
+                  {
+                    databaseId: 2217789,
+                    createdAt: '2022-02-21T03:30:42Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2223243,
-                        createdAt: '2022-02-21T18:26:27Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2232922,
-                                createdAt: '2022-02-23T00:57:58Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2223243,
+                    createdAt: '2022-02-21T18:26:27Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2232922,
+                          createdAt: '2022-02-23T00:57:58Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2232921,
-                        createdAt: '2022-02-23T00:57:49Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+                  },
+                  {
+                    databaseId: 2232921,
+                    createdAt: '2022-02-23T00:57:49Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2258799,
-                        createdAt: '2022-02-27T01:22:20Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300902,
-                                createdAt: '2022-03-05T17:43:52Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2258799,
+                    createdAt: '2022-02-27T01:22:20Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300902,
+                          createdAt: '2022-03-05T17:43:52Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2297637,
-                        createdAt: '2022-03-04T20:39:44Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300893,
-                                createdAt: '2022-03-05T17:41:04Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2297637,
+                    createdAt: '2022-03-04T20:39:44Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300893,
+                          createdAt: '2022-03-05T17:41:04Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2299763,
-                        createdAt: '2022-03-05T11:05:42Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300895,
-                                createdAt: '2022-03-05T17:41:44Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2299763,
+                    createdAt: '2022-03-05T11:05:42Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300895,
+                          createdAt: '2022-03-05T17:41:44Z',
                         },
-                      },
+                      ],
                     },
-                  ],
-                },
+                  },
+                ],
               },
             },
             {
-              node: {
-                viewerSubscription: 'IGNORED',
-                title: '1.16.0',
-                url: 'https://github.com/manosim/notifications-test/discussions/612',
-                comments: {
-                  edges: [
-                    {
-                      node: {
-                        databaseId: 2215656,
-                        createdAt: '2022-02-20T18:33:39Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+              viewerSubscription: 'IGNORED',
+              title: '1.16.0',
+              url: 'https://github.com/manosim/notifications-test/discussions/612',
+              comments: {
+                nodes: [
+                  {
+                    databaseId: 2215656,
+                    createdAt: '2022-02-20T18:33:39Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2217789,
-                        createdAt: '2022-02-21T03:30:42Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+                  },
+                  {
+                    databaseId: 2217789,
+                    createdAt: '2022-02-21T03:30:42Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2223243,
-                        createdAt: '2022-02-21T18:26:27Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2232922,
-                                createdAt: '2022-02-23T00:57:58Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2223243,
+                    createdAt: '2022-02-21T18:26:27Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2232922,
+                          createdAt: '2022-02-23T00:57:58Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2232921,
-                        createdAt: '2022-02-23T00:57:49Z',
-                        replies: {
-                          edges: [],
-                        },
-                      },
+                  },
+                  {
+                    databaseId: 2232921,
+                    createdAt: '2022-02-23T00:57:49Z',
+                    replies: {
+                      nodes: [],
                     },
-                    {
-                      node: {
-                        databaseId: 2258799,
-                        createdAt: '2022-02-27T01:22:20Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300902,
-                                createdAt: '2022-03-05T17:43:52Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2258799,
+                    createdAt: '2022-02-27T01:22:20Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300902,
+                          createdAt: '2022-03-05T17:43:52Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2297637,
-                        createdAt: '2022-03-04T20:39:44Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300893,
-                                createdAt: '2022-03-05T17:41:04Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2297637,
+                    createdAt: '2022-03-04T20:39:44Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300893,
+                          createdAt: '2022-03-05T17:41:04Z',
                         },
-                      },
+                      ],
                     },
-                    {
-                      node: {
-                        databaseId: 2299763,
-                        createdAt: '2022-03-05T11:05:42Z',
-                        replies: {
-                          edges: [
-                            {
-                              node: {
-                                databaseId: 2300895,
-                                createdAt: '2022-03-05T17:41:44Z',
-                              },
-                            },
-                          ],
+                  },
+                  {
+                    databaseId: 2299763,
+                    createdAt: '2022-03-05T11:05:42Z',
+                    replies: {
+                      nodes: [
+                        {
+                          databaseId: 2300895,
+                          createdAt: '2022-03-05T17:41:44Z',
                         },
-                      },
+                      ],
                     },
-                  ],
-                },
+                  },
+                ],
               },
             },
           ],
diff --git a/src/typesGithub.ts b/src/typesGithub.ts
index d051ab67..2f46d015 100644
--- a/src/typesGithub.ts
+++ b/src/typesGithub.ts
@@ -169,47 +169,39 @@ export interface GraphQLSearch<T> {
   data: {
     data: {
       search: {
-        edges: T[];
+        nodes: T[];
       };
     };
   };
 }
 
-export interface DiscussionStateSearchResultEdge {
-  node: {
-    viewerSubscription: ViewerSubscription;
-    title: string;
-    stateReason: DiscussionStateType;
-    isAnswered: boolean;
-  };
+export interface DiscussionStateSearchResultNode {
+  viewerSubscription: ViewerSubscription;
+  title: string;
+  stateReason: DiscussionStateType;
+  isAnswered: boolean;
 }
 
-export interface DiscussionSearchResultEdge {
-  node: {
-    viewerSubscription: ViewerSubscription;
-    title: string;
-    url: string;
-    comments: {
-      edges: DiscussionCommentEdge[];
-    };
+export interface DiscussionSearchResultNode {
+  viewerSubscription: ViewerSubscription;
+  title: string;
+  url: string;
+  comments: {
+    nodes: DiscussionCommentNode[];
   };
 }
 
-export interface DiscussionCommentEdge {
-  node: {
-    databaseId: string | number;
-    createdAt: string;
-    replies: {
-      edges: DiscussionSubcommentEdge[];
-    };
+export interface DiscussionCommentNode {
+  databaseId: string | number;
+  createdAt: string;
+  replies: {
+    nodes: DiscussionSubcommentNode[];
   };
 }
 
-export interface DiscussionSubcommentEdge {
-  node: {
-    databaseId: string | number;
-    createdAt: string;
-  };
+export interface DiscussionSubcommentNode {
+  databaseId: string | number;
+  createdAt: string;
 }
 
 export interface CheckSuiteAttributes {
diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts
index 2ccdbe9b..64cd9335 100644
--- a/src/utils/helpers.ts
+++ b/src/utils/helpers.ts
@@ -2,12 +2,13 @@ import { EnterpriseAccount, AuthState } from '../types';
 import {
   Notification,
   GraphQLSearch,
-  DiscussionCommentEdge,
-  DiscussionSearchResultEdge,
+  DiscussionCommentNode,
+  DiscussionSearchResultNode,
 } from '../typesGithub';
 import { apiRequestAuth } from '../utils/api-requests';
 import { openExternalLink } from '../utils/comms';
 import { Constants } from './constants';
+import { getWorkflowRunAttributes } from './state';
 
 export function getEnterpriseAccountToken(
   hostname: string,
@@ -70,61 +71,75 @@ export async function getHtmlUrl(url: string, token: string): Promise<string> {
   return response.data.html_url;
 }
 
+export function getWorkflowRunUrl(notification: Notification) {
+  let url = `${notification.repository.html_url}/actions`;
+  let filters = [];
+
+  const workflowRunAttributes = getWorkflowRunAttributes(notification);
+
+  if (workflowRunAttributes?.status) {
+    filters.push(`is:${workflowRunAttributes.status}`);
+  }
+
+  if (filters.length > 0) {
+    url += `?query=${filters.join('+')}`;
+  }
+
+  return url;
+}
+
 async function getDiscussionUrl(
   notification: Notification,
   token: string,
 ): Promise<string> {
   let url = `${notification.repository.html_url}/discussions`;
 
-  const response: GraphQLSearch<DiscussionSearchResultEdge> =
+  const response: GraphQLSearch<DiscussionSearchResultNode> =
     await apiRequestAuth(`https://api.github.com/graphql`, 'POST', token, {
       query: `{
-      search(query:"${formatSearchQueryString(
-        notification.repository.full_name,
-        notification.subject.title,
-        notification.updated_at,
-      )}", type: DISCUSSION, first: 10) {
-          edges {
-              node {
-                  ... on Discussion {
-                      viewerSubscription
-                      title
-                      url
-                      comments(last: 100) {
-                        edges {
-                          node {
-                            databaseId
-                            createdAt
-                            replies(last: 1) {
-                              edges {
-                                node {
-                                  databaseId
-                                  createdAt
-                                }
-                              }
-                            }
-                          }
-                        }
-                      }
+        search(query:"${formatSearchQueryString(
+          notification.repository.full_name,
+          notification.subject.title,
+          notification.updated_at,
+        )}", type: DISCUSSION, first: 10) {
+          nodes {
+            ... on Discussion {
+              viewerSubscription
+              title
+              url
+              comments(last: 100) {
+                nodes {
+                  databaseId
+                  createdAt
+                  replies(last: 1) {
+                    nodes {
+                      databaseId
+                      createdAt
+                    }
                   }
+                }
               }
+            }
           }
-      }
-    }`,
+        }
+      }`,
     });
-  let edges =
-    response?.data?.data?.search?.edges?.filter(
-      (edge) => edge.node.title === notification.subject.title,
+
+  let discussions =
+    response?.data?.data?.search?.nodes?.filter(
+      (discussion) => discussion.title === notification.subject.title,
     ) || [];
-  if (edges.length > 1)
-    edges = edges.filter(
-      (edge) => edge.node.viewerSubscription === 'SUBSCRIBED',
+
+  if (discussions.length > 1)
+    discussions = discussions.filter(
+      (discussion) => discussion.viewerSubscription === 'SUBSCRIBED',
     );
 
-  if (edges[0]) {
-    url = edges[0].node.url;
+  if (discussions[0]) {
+    const discussion = discussions[0];
+    url = discussion.url;
 
-    let comments = edges[0]?.node.comments.edges;
+    let comments = discussion.comments.nodes;
 
     let latestCommentId: string | number;
     if (comments?.length) {
@@ -137,13 +152,12 @@ async function getDiscussionUrl(
 }
 
 export const getLatestDiscussionCommentId = (
-  comments: DiscussionCommentEdge[],
+  comments: DiscussionCommentNode[],
 ) =>
   comments
-    .flatMap((comment) => comment.node.replies.edges)
+    .flatMap((comment) => comment.replies.nodes)
     .concat([comments.at(-1)])
-    .reduce((a, b) => (a.node.createdAt > b.node.createdAt ? a : b))?.node
-    .databaseId;
+    .reduce((a, b) => (a.createdAt > b.createdAt ? a : b))?.databaseId;
 
 export async function generateGitHubWebUrl(
   notification: Notification,
@@ -167,6 +181,9 @@ export async function generateGitHubWebUrl(
       case 'RepositoryInvitation':
         url = `${notification.repository.html_url}/invitations`;
         break;
+      case 'WorkflowRun':
+        url = getWorkflowRunUrl(notification);
+        break;
       default:
         url = notification.repository.html_url;
         break;
diff --git a/src/utils/state.ts b/src/utils/state.ts
index 4d2b79c6..ad783e89 100644
--- a/src/utils/state.ts
+++ b/src/utils/state.ts
@@ -2,7 +2,7 @@ import { formatSearchQueryString } from './helpers';
 import {
   CheckSuiteAttributes,
   CheckSuiteStatus,
-  DiscussionStateSearchResultEdge,
+  DiscussionStateSearchResultNode,
   DiscussionStateType,
   GraphQLSearch,
   IssueStateType,
@@ -81,46 +81,45 @@ export async function getDiscussionState(
   notification: Notification,
   token: string,
 ): Promise<DiscussionStateType> {
-  const response: GraphQLSearch<DiscussionStateSearchResultEdge> =
+  const response: GraphQLSearch<DiscussionStateSearchResultNode> =
     await apiRequestAuth(`https://api.github.com/graphql`, 'POST', token, {
       query: `{
-          search(query:"${formatSearchQueryString(
-            notification.repository.full_name,
-            notification.subject.title,
-            notification.updated_at,
-          )}", type: DISCUSSION, first: 10) {
-            edges {
-              node {
-                ... on Discussion {
-                  viewerSubscription
-                  title
-                  stateReason  
-                  isAnswered
-                }
-              }
+        search(query:"${formatSearchQueryString(
+          notification.repository.full_name,
+          notification.subject.title,
+          notification.updated_at,
+        )}", type: DISCUSSION, first: 10) {
+          nodes {
+            ... on Discussion {
+              viewerSubscription
+              title
+              stateReason  
+              isAnswered
             }
           }
-        }`,
+        }
+      }`,
     });
 
-  let edges =
-    response?.data?.data?.search?.edges?.filter(
-      (edge) => edge.node.title === notification.subject.title,
+  let discussions =
+    response?.data?.data?.search?.nodes?.filter(
+      (discussion) => discussion.title === notification.subject.title,
     ) || [];
 
-  if (edges.length > 1) {
-    edges = edges.filter(
-      (edge) => edge.node.viewerSubscription === 'SUBSCRIBED',
+  if (discussions.length > 1) {
+    discussions = discussions.filter(
+      (discussion) => discussion.viewerSubscription === 'SUBSCRIBED',
     );
   }
 
-  if (edges[0]) {
-    if (edges[0].node.isAnswered) {
+  if (discussions[0]) {
+    const discussion = discussions[0];
+    if (discussion.isAnswered) {
       return 'ANSWERED';
     }
 
-    if (edges[0].node.stateReason) {
-      return edges[0].node.stateReason;
+    if (discussion.stateReason) {
+      return discussion.stateReason;
     }
   }
 


Test patch:
diff --git a/src/utils/helpers.test.ts b/src/utils/helpers.test.ts
index 8cef1c3c..c4473f22 100644
--- a/src/utils/helpers.test.ts
+++ b/src/utils/helpers.test.ts
@@ -310,6 +310,75 @@ describe('utils/helpers.ts', () => {
       );
     });
 
+    describe('Workflow Run URLs', () => {
+      it('approval requested', async () => {
+        const subject = {
+          title: 'some-user requested your review to deploy to an environment',
+          url: null,
+          latest_comment_url: null,
+          type: 'WorkflowRun' as SubjectType,
+        };
+
+        const result = await generateGitHubWebUrl(
+          {
+            ...mockedSingleNotification,
+            subject: subject,
+          },
+          mockAccounts,
+        );
+
+        expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
+        expect(result).toBe(
+          `https://github.com/manosim/notifications-test/actions?query=is%3Awaiting&${mockedNotificationReferrer}`,
+        );
+      });
+
+      it('unhandled status/action scenario', async () => {
+        const subject = {
+          title:
+            'some-user requested your unhandled-action to deploy to an environment',
+          url: null,
+          latest_comment_url: null,
+          type: 'WorkflowRun' as SubjectType,
+        };
+
+        const result = await generateGitHubWebUrl(
+          {
+            ...mockedSingleNotification,
+            subject: subject,
+          },
+          mockAccounts,
+        );
+
+        expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
+        expect(result).toBe(
+          `https://github.com/manosim/notifications-test/actions?${mockedNotificationReferrer}`,
+        );
+      });
+
+      it('unhandled workflow scenario', async () => {
+        const subject = {
+          title: 'some unhandled scenario',
+          url: null,
+          latest_comment_url: null,
+          type: 'WorkflowRun' as SubjectType,
+        };
+
+        const result = await generateGitHubWebUrl(
+          {
+            ...mockedSingleNotification,
+            subject: subject,
+          },
+          mockAccounts,
+        );
+
+        expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
+        expect(result).toBe(
+          `https://github.com/manosim/notifications-test/actions?${mockedNotificationReferrer}`,
+        );
+      });
+    });
+
     it('defaults to repository url', async () => {
       const subject = {
         title: 'generate github web url unit tests',
diff --git a/src/utils/state.test.ts b/src/utils/state.test.ts
index 0335dde1..89a62318 100644
--- a/src/utils/state.test.ts
+++ b/src/utils/state.test.ts
@@ -150,14 +150,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is an answered discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: null,
-                    isAnswered: true,
-                  },
+                  title: 'This is an answered discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: null,
+                  isAnswered: true,
                 },
               ],
             },
@@ -186,14 +184,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is a duplicate discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: 'DUPLICATE',
-                    isAnswered: false,
-                  },
+                  title: 'This is a duplicate discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: 'DUPLICATE',
+                  isAnswered: false,
                 },
               ],
             },
@@ -222,14 +218,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is an open discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: null,
-                    isAnswered: false,
-                  },
+                  title: 'This is an open discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: null,
+                  isAnswered: false,
                 },
               ],
             },
@@ -258,14 +252,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is an outdated discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: 'OUTDATED',
-                    isAnswered: false,
-                  },
+                  title: 'This is an outdated discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: 'OUTDATED',
+                  isAnswered: false,
                 },
               ],
             },
@@ -294,14 +286,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is a reopened discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: 'REOPENED',
-                    isAnswered: false,
-                  },
+                  title: 'This is a reopened discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: 'REOPENED',
+                  isAnswered: false,
                 },
               ],
             },
@@ -330,14 +320,12 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is a resolved discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: 'RESOLVED',
-                    isAnswered: false,
-                  },
+                  title: 'This is a resolved discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: 'RESOLVED',
+                  isAnswered: false,
                 },
               ],
             },
@@ -366,22 +354,18 @@ describe('utils/state.ts', () => {
         .reply(200, {
           data: {
             search: {
-              edges: [
+              nodes: [
                 {
-                  node: {
-                    title: 'This is a discussion',
-                    viewerSubscription: 'SUBSCRIBED',
-                    stateReason: null,
-                    isAnswered: false,
-                  },
+                  title: 'This is a discussion',
+                  viewerSubscription: 'SUBSCRIBED',
+                  stateReason: null,
+                  isAnswered: false,
                 },
                 {
-                  node: {
-                    title: 'This is a discussion',
-                    viewerSubscription: 'IGNORED',
-                    stateReason: null,
-                    isAnswered: true,
-                  },
+                  title: 'This is a discussion',
+                  viewerSubscription: 'IGNORED',
+                  stateReason: null,
+                  isAnswered: true,
                 },
               ],
             },