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

Commit

Permalink
failing test for #170 (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley committed May 3, 2017
1 parent e12fbb1 commit 3a5523d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
24 changes: 24 additions & 0 deletions npm-debug.log.3540064644
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'test--watch' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: test--watch
4 verbose stack at run (/usr/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /usr/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:356:5
4 verbose stack at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:45)
4 verbose stack at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:354:3)
4 verbose stack at then (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
4 verbose stack at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:311:12
4 verbose stack at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
4 verbose stack at tryToString (fs.js:455:3)
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)
5 verbose cwd /mnt/c/Users/james.baxley/Products/apollo/react-apollo
6 error Linux 4.4.0-43-Microsoft
7 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "test--watch"
8 error node v6.10.0
9 error npm v3.10.10
10 error missing script: test--watch
11 error If you need help, you may report this error at:
11 error <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]
41 changes: 41 additions & 0 deletions test/react-web/client/graphql/queries.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,47 @@ describe('queries', () => {
expect(Object.keys((client as any).queryManager.observableQueries)).toEqual(['1']);
});

it('renders loading state correctly when recycling queries with different variables but the same result', (done) => {
const query = gql`
query remount($first: Int) { allPeople(first: $first) { people { name } } }
`;
const data = { allPeople: null };
const variables = { first: 1 };
const variables2 = { first: 2 };
const networkInterface = mockNetworkInterface(
{ request: { query, variables }, result: { data }, delay: 10 },
{ request: { query, variables: variables2 }, result: { data }, delay: 10 }
);
const client = new ApolloClient({ networkInterface, addTypename: false });
let count = 0;
let firstCount = 1;
let wrapper;
@graphql(query, { options: ({ first }) => ({ variables: { first: firstCount }})})
class Container extends React.Component<any, any> {

componentWillReceiveProps(props) {
if (count === 0) {
expect(props.data.loading).toBe(false); // got data for first request
wrapper.unmount();
firstCount = 2;
wrapper = renderer.create(<ApolloProvider client={client}><Container /></ApolloProvider>);
}

if (count === 1) {
expect(props.data.loading).toBe(false); // on second request
done();
}

count++;
}
render() {
return null;
}
};
wrapper = renderer.create(<ApolloProvider client={client}><Container /></ApolloProvider>);

});

it('will not try to refetch recycled `ObservableQuery`s when resetting the client store', (done) => {
const query = gql`query people { allPeople(first: 1) { people { name } } }`;
const data = { allPeople: { people: [ { name: 'Luke Skywalker' } ] } };
Expand Down

0 comments on commit 3a5523d

Please sign in to comment.