Skip to content

Commit

Permalink
Remove remaining no longer necessary custom setOnError functions
Browse files Browse the repository at this point in the history
While all tests are passing with the remaining custom setOnError
functions (added in
de47804),
they are no longer necessary as `MockLink` will no longer
throw uncaught exceptions (by default).
  • Loading branch information
hwillson committed Oct 1, 2020
1 parent 40736ec commit d3aca0b
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 97 deletions.
86 changes: 43 additions & 43 deletions src/__tests__/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query, variables },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -251,7 +251,7 @@ describe('client', () => {
}, {
request: { query, variables: override },
result: { data: overriddenResult },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -396,7 +396,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const initialState: any = {
data: {
Expand Down Expand Up @@ -454,7 +454,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const initialState: any = {
data: {
Expand Down Expand Up @@ -510,7 +510,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const initialState: any = {
data: {
Expand Down Expand Up @@ -569,7 +569,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { errors },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -732,7 +732,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -777,7 +777,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: {},
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -819,7 +819,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -875,7 +875,7 @@ describe('client', () => {
}, {
request: { query: transformedQuery },
result: { data: transformedResult },
}, false).setOnError(reject);
}, false);

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -924,7 +924,7 @@ describe('client', () => {
}, {
request: { query: transformedQuery },
result: { data: transformedResult },
}, false).setOnError(reject);
}, false);

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -967,7 +967,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query: mutation },
result: { data: result },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -1003,7 +1003,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1049,7 +1049,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: result },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -1085,7 +1085,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: result },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -1131,7 +1131,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: result },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({
Expand Down Expand Up @@ -1180,7 +1180,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1243,7 +1243,7 @@ describe('client', () => {
}, {
request: { query: mutation },
result: { data: mutationResult },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1368,7 +1368,7 @@ describe('client', () => {
request: { query: queryDoc },
result: { data: data2 },
},
).setOnError(reject);
);

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1414,7 +1414,7 @@ describe('client', () => {
}, {
request: { query: queryDoc },
result: { data: data2 },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -1626,7 +1626,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1720,7 +1720,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: networkFetch },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1748,7 +1748,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data: networkFetch },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -1794,7 +1794,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { errors: [{ message: 'network failure' }] },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -1843,7 +1843,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({ link, cache: new InMemoryCache() });

Expand Down Expand Up @@ -1884,7 +1884,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({ link, cache: new InMemoryCache() });

Expand Down Expand Up @@ -1936,7 +1936,7 @@ describe('client', () => {
}, {
request: { query },
result: { data: secondFetch },
}).setOnError(reject);
});
}

itAsync('forces the query to rerun', (resolve, reject) => {
Expand Down Expand Up @@ -2066,7 +2066,7 @@ describe('client', () => {
link: mockSingleLink({
request: { query: mutation },
result: { data, errors },
}).setOnError(reject),
}),
cache: new InMemoryCache({ addTypename: false }),
});
client
Expand Down Expand Up @@ -2103,7 +2103,7 @@ describe('client', () => {
link: mockSingleLink({
request: { query: mutation },
result: { data, errors },
}).setOnError(reject),
}),
cache: new InMemoryCache({ addTypename: false }),
});
client
Expand Down Expand Up @@ -2142,7 +2142,7 @@ describe('client', () => {
link: mockSingleLink({
request: { query: mutation },
result: { data, errors },
}).setOnError(reject),
}),
cache: new InMemoryCache({ addTypename: false }),
});
client
Expand Down Expand Up @@ -2181,7 +2181,7 @@ describe('client', () => {
link: mockSingleLink({
request: { query: mutation },
result: { data, errors },
}).setOnError(reject),
}),
cache: new InMemoryCache({ addTypename: false }),
});
const mutatePromise = client.mutate({
Expand Down Expand Up @@ -2589,7 +2589,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result: { errors },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache(),
Expand Down Expand Up @@ -2628,7 +2628,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query },
result,
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({
Expand Down Expand Up @@ -2677,7 +2677,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query: transformedQuery },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -2719,7 +2719,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query: transformedQuery },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -2771,7 +2771,7 @@ describe('client', () => {
const link = mockSingleLink({
request: { query: transformedQuery },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -2815,7 +2815,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query: transformedQuery },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -2860,7 +2860,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query: transformedQuery, variables },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -2904,7 +2904,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query: transformedQuery, variables },
result: { data: result },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -3138,7 +3138,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query },
result: { data: networkFetch },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -3267,7 +3267,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query },
result: { errors },
}).setOnError(reject);
});
const client = new ApolloClient({
link,
cache: new InMemoryCache({ addTypename: false }),
Expand Down Expand Up @@ -3297,7 +3297,7 @@ describe('@connection', () => {
const link = mockSingleLink({
request: { query: mutation, variables: { id: 1 } },
result: { data },
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down Expand Up @@ -3330,7 +3330,7 @@ function clientRoundtrip(
const link = mockSingleLink({
request: { query: cloneDeep(query) },
result: data,
}).setOnError(reject);
});

const client = new ApolloClient({
link,
Expand Down
Loading

0 comments on commit d3aca0b

Please sign in to comment.