Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed Jul 31, 2017
1 parent 3f4c248 commit 90b9df6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 8 additions & 12 deletions test/react-web/client/graphql/shared-operations.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
);
});
});

Expand Down Expand Up @@ -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,
Expand All @@ -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 => {
Expand Down

0 comments on commit 90b9df6

Please sign in to comment.