From 90b9df68ee17d6405de3371ebbf59afdd6943194 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Mon, 31 Jul 2017 15:13:15 +0200 Subject: [PATCH] fix tests --- src/graphql.tsx | 2 +- .../client/graphql/shared-operations.test.tsx | 20 ++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/graphql.tsx b/src/graphql.tsx index 23ca4a1815..657a3e5a34 100644 --- a/src/graphql.tsx +++ b/src/graphql.tsx @@ -593,7 +593,7 @@ export default function graphql< const mergedPropsAndData = assign({}, props, clientProps); if (operationOptions.withRef) - mergedPropsAndData.ref = 'wrappedInstance'; + mergedPropsAndData.ref = this.setWrappedInstance; this.renderedElement = createElement( WrappedComponent, mergedPropsAndData, diff --git a/test/react-web/client/graphql/shared-operations.test.tsx b/test/react-web/client/graphql/shared-operations.test.tsx index 448ab197eb..0108f6c586 100644 --- a/test/react-web/client/graphql/shared-operations.test.tsx +++ b/test/react-web/client/graphql/shared-operations.test.tsx @@ -64,9 +64,7 @@ describe('shared operations', () => { expect((decorated as any).getWrappedInstance().someMethod()).toEqual( testData, ); - expect((decorated as any).refs.wrappedInstance.someMethod()).toEqual( - testData, - ); + expect((decorated as any).wrappedInstance.someMethod()).toEqual(testData); const DecoratedWithSkip = withApollo(Container, { withRef: true, @@ -88,9 +86,9 @@ describe('shared operations', () => { expect( (decoratedWithSkip as any).getWrappedInstance().someMethod(), ).toEqual(testData); - expect( - (decoratedWithSkip as any).refs.wrappedInstance.someMethod(), - ).toEqual(testData); + expect((decoratedWithSkip as any).wrappedInstance.someMethod()).toEqual( + testData, + ); }); }); @@ -301,9 +299,7 @@ describe('shared operations', () => { expect((decorated as any).getWrappedInstance().someMethod()).toEqual( testData, ); - expect((decorated as any).refs.wrappedInstance.someMethod()).toEqual( - testData, - ); + expect((decorated as any).wrappedInstance.someMethod()).toEqual(testData); const DecoratedWithSkip = graphql(query, { withRef: true, skip: true })( Container, @@ -324,9 +320,9 @@ describe('shared operations', () => { expect( (decoratedWithSkip as any).getWrappedInstance().someMethod(), ).toEqual(testData); - expect( - (decoratedWithSkip as any).refs.wrappedInstance.someMethod(), - ).toEqual(testData); + expect((decoratedWithSkip as any).wrappedInstance.someMethod()).toEqual( + testData, + ); }); it('allows options to take an object', done => {