@@ -3,22 +3,27 @@ import { within, waitFor } from "@testing-library/react";
33import user from "@testing-library/user-event" ;
44
55import { renderWithApolloClient } from "../../../utilities/testing/renderWithApolloClient" ;
6- import { client , GET_MUTATIONS } from "../../../index" ;
6+ import { client , currentClient , GET_MUTATIONS } from "../../../index" ;
77import { Mutations } from "../Mutations" ;
88
99jest . mock ( "../MutationViewer" , ( ) => ( {
1010 MutationViewer : ( ) => null ,
1111} ) ) ;
1212
13+
14+ const clientId = "client-1" ;
15+
1316describe ( "<Mutations />" , ( ) => {
1417 const mutations = [
1518 {
1619 id : 0 ,
20+ clientId,
1721 __typename : "Mutation" ,
1822 name : null ,
1923 } ,
2024 {
2125 id : 1 ,
26+ clientId,
2227 __typename : "Mutation" ,
2328 name : "AddColorToFavorites" ,
2429 } ,
@@ -34,14 +39,22 @@ describe("<Mutations />", () => {
3439 } ) ;
3540
3641 test ( "queries render in the sidebar" , async ( ) => {
42+ currentClient ( clientId ) ;
3743 client . writeQuery ( {
3844 query : GET_MUTATIONS ,
3945 data : {
40- mutationLog : {
41- mutations,
42- count : mutations . length ,
43- } ,
46+ client : {
47+ id : clientId ,
48+ __typename : "Client" ,
49+ mutationLog : {
50+ mutations,
51+ count : mutations . length ,
52+ } ,
53+ }
4454 } ,
55+ variables : {
56+ clientId
57+ }
4558 } ) ;
4659
4760 const { getByTestId } = renderWithApolloClient (
@@ -63,14 +76,22 @@ describe("<Mutations />", () => {
6376 } ) ;
6477
6578 test ( "renders query name" , async ( ) => {
79+ currentClient ( clientId )
6680 client . writeQuery ( {
6781 query : GET_MUTATIONS ,
6882 data : {
69- mutationLog : {
70- mutations,
71- count : mutations . length ,
72- } ,
83+ client : {
84+ id : clientId ,
85+ __typename : "Client" ,
86+ mutationLog : {
87+ mutations,
88+ count : mutations . length ,
89+ }
90+ }
7391 } ,
92+ variables : {
93+ clientId
94+ }
7495 } ) ;
7596
7697 const { getByTestId } = renderWithApolloClient (
0 commit comments