Skip to content

Commit 675829c

Browse files
Fix failing tests for cache
1 parent 73e6cd1 commit 675829c

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

src/application/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { useEffect, useState } from "react";
22
import { useReactiveVar, gql, useQuery, makeVar } from "@apollo/client";
33

4-
import { currentScreen, Screens } from "./components/Layouts/Navigation";
4+
import { currentScreen } from "./components/Layouts/Navigation";
5+
import { Screens } from "./components/Layouts/screens";
56
import { Queries } from "./components/Queries/Queries";
67
import { Mutations } from "./components/Mutations/Mutations";
78
import { Explorer } from "./components/Explorer/Explorer";
89
import { Cache } from "./components/Cache/Cache";
910
import { clients, currentClient } from ".";
1011

1112
export const reloadStatus = makeVar<boolean>(false);
12-
console.log(Screens)
1313

1414
const screens = {
1515
[Screens.Explorer]: Explorer,

src/application/__tests__/App.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import React from "react";
22
import { waitFor } from "@testing-library/react";
33

44
import { renderWithApolloClient } from "../utilities/testing/renderWithApolloClient";
5-
import { currentScreen, Screens } from "../components/Layouts/Navigation";
5+
import { currentScreen } from "../components/Layouts/Navigation";
66
import { App, reloadStatus } from "../App";
7+
import { Screens } from "../components/Layouts/screens";
78

89
jest.mock("../components/Queries/Queries", () => ({
910
Queries: ({ navigationProps }) => (

src/application/components/Cache/__tests__/Cache.test.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ describe("Cache component tests", () => {
6565

6666
describe("With cache data", () => {
6767
beforeEach(() => {
68-
client.resetStore();
69-
const clientId = "client-1"
70-
currentClient(clientId)
68+
const clientId = "client-1";
69+
currentClient(clientId);
7170
writeData({
7271
id: clientId,
7372
queries: [],
@@ -76,6 +75,10 @@ describe("Cache component tests", () => {
7675
});
7776
});
7877

78+
afterEach(() => {
79+
client.resetStore();
80+
});
81+
7982
it("should show list of root cache ids in the sidebar", () => {
8083
const { getByTestId } = renderWithApolloClient(
8184
<Cache navigationProps={navigationProps} />
@@ -125,7 +128,7 @@ describe("Cache component tests", () => {
125128

126129
beforeEach(() => {
127130
const clientId = "client-1";
128-
currentClient(clientId)
131+
currentClient(clientId);
129132
writeData({
130133
id: clientId,
131134
queries: [],

src/application/components/Layouts/Navigation.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ import { rem } from "polished";
77
import { colors } from "@apollo/space-kit/colors";
88
import { ApolloLogo } from "@apollo/space-kit/icons/ApolloLogo";
99
import { clients, currentClient } from "../..";
10-
11-
export enum Screens {
12-
Cache = "cache",
13-
Queries = "queries",
14-
Mutations = "mutations",
15-
Explorer = "explorer",
16-
}
10+
import { Screens } from "./screens";
1711

1812
type NavButtonProps = {
1913
isSelected: boolean;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export enum Screens {
2+
Cache = "cache",
3+
Queries = "queries",
4+
Mutations = "mutations",
5+
Explorer = "explorer",
6+
}

src/application/components/Queries/RunInExplorerButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
postMessageToEmbed,
88
SET_OPERATION,
99
} from "../Explorer/postMessageHelpers";
10-
import { currentScreen, Screens } from "../Layouts/Navigation";
10+
import { currentScreen } from "../Layouts/Navigation";
11+
import { Screens } from "../Layouts/screens";
1112

1213
interface RunInExplorerButtonProps {
1314
operation: string;

0 commit comments

Comments
 (0)