diff --git a/src/__tests__/client.ts b/src/__tests__/client.ts index 7f7c84fa2ef..dc637f3f8f7 100644 --- a/src/__tests__/client.ts +++ b/src/__tests__/client.ts @@ -187,7 +187,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query, variables }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -251,7 +251,7 @@ describe('client', () => { }, { request: { query, variables: override }, result: { data: overriddenResult }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -396,7 +396,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const initialState: any = { data: { @@ -454,7 +454,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const initialState: any = { data: { @@ -510,7 +510,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const initialState: any = { data: { @@ -569,7 +569,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { errors }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -732,7 +732,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -777,7 +777,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: {}, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -819,7 +819,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -875,7 +875,7 @@ describe('client', () => { }, { request: { query: transformedQuery }, result: { data: transformedResult }, - }, false).setOnError(reject); + }, false); const client = new ApolloClient({ link, @@ -924,7 +924,7 @@ describe('client', () => { }, { request: { query: transformedQuery }, result: { data: transformedResult }, - }, false).setOnError(reject); + }, false); const client = new ApolloClient({ link, @@ -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 }), @@ -1003,7 +1003,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -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 }), @@ -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 }), @@ -1131,7 +1131,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache({ @@ -1180,7 +1180,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -1243,7 +1243,7 @@ describe('client', () => { }, { request: { query: mutation }, result: { data: mutationResult }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -1368,7 +1368,7 @@ describe('client', () => { request: { query: queryDoc }, result: { data: data2 }, }, - ).setOnError(reject); + ); const client = new ApolloClient({ link, @@ -1414,7 +1414,7 @@ describe('client', () => { }, { request: { query: queryDoc }, result: { data: data2 }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache({ addTypename: false }), @@ -1626,7 +1626,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -1720,7 +1720,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data: networkFetch }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -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 }), @@ -1794,7 +1794,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { errors: [{ message: 'network failure' }] }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -1843,7 +1843,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache() }); @@ -1884,7 +1884,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache() }); @@ -1936,7 +1936,7 @@ describe('client', () => { }, { request: { query }, result: { data: secondFetch }, - }).setOnError(reject); + }); } itAsync('forces the query to rerun', (resolve, reject) => { @@ -2066,7 +2066,7 @@ describe('client', () => { link: mockSingleLink({ request: { query: mutation }, result: { data, errors }, - }).setOnError(reject), + }), cache: new InMemoryCache({ addTypename: false }), }); client @@ -2103,7 +2103,7 @@ describe('client', () => { link: mockSingleLink({ request: { query: mutation }, result: { data, errors }, - }).setOnError(reject), + }), cache: new InMemoryCache({ addTypename: false }), }); client @@ -2142,7 +2142,7 @@ describe('client', () => { link: mockSingleLink({ request: { query: mutation }, result: { data, errors }, - }).setOnError(reject), + }), cache: new InMemoryCache({ addTypename: false }), }); client @@ -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({ @@ -2589,7 +2589,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result: { errors }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache(), @@ -2628,7 +2628,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query }, result, - }).setOnError(reject); + }); const client = new ApolloClient({ link, cache: new InMemoryCache({ @@ -2677,7 +2677,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query: transformedQuery }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -2719,7 +2719,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query: transformedQuery }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -2771,7 +2771,7 @@ describe('client', () => { const link = mockSingleLink({ request: { query: transformedQuery }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -2815,7 +2815,7 @@ describe('@connection', () => { const link = mockSingleLink({ request: { query: transformedQuery }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -2860,7 +2860,7 @@ describe('@connection', () => { const link = mockSingleLink({ request: { query: transformedQuery, variables }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -2904,7 +2904,7 @@ describe('@connection', () => { const link = mockSingleLink({ request: { query: transformedQuery, variables }, result: { data: result }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -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 }), @@ -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 }), @@ -3297,7 +3297,7 @@ describe('@connection', () => { const link = mockSingleLink({ request: { query: mutation, variables: { id: 1 } }, result: { data }, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -3330,7 +3330,7 @@ function clientRoundtrip( const link = mockSingleLink({ request: { query: cloneDeep(query) }, result: data, - }).setOnError(reject); + }); const client = new ApolloClient({ link, diff --git a/src/__tests__/fetchMore.ts b/src/__tests__/fetchMore.ts index 7b7a5512387..255bbfbee60 100644 --- a/src/__tests__/fetchMore.ts +++ b/src/__tests__/fetchMore.ts @@ -31,7 +31,7 @@ describe('updateQuery on a simple query', () => { const link = mockSingleLink({ request: { query }, result, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -97,7 +97,7 @@ describe('updateQuery on a query with required and optional variables', () => { variables, }, result, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -206,7 +206,7 @@ describe('fetchMore on an observable query', () => { variables, }, result, - }, ...mockedResponses).setOnError(reject); + }, ...mockedResponses); const client = new ApolloClient({ link, @@ -241,7 +241,7 @@ describe('fetchMore on an observable query', () => { variables, }, result, - }, ...mockedResponses).setOnError(reject), + }, ...mockedResponses), cache: new InMemoryCache(cacheConfig), }); @@ -509,7 +509,7 @@ describe('fetchMore on an observable query', () => { groceries: additionalGroceries, }, }, - }).setOnError(reject), + }), }); const observable = client.watchQuery({ @@ -821,7 +821,7 @@ describe('fetchMore on an observable query with connection', () => { variables, }, result, - }, ...mockedResponses).setOnError(reject); + }, ...mockedResponses); const client = new ApolloClient({ link, @@ -856,7 +856,7 @@ describe('fetchMore on an observable query with connection', () => { variables, }, result, - }, ...mockedResponses).setOnError(reject), + }, ...mockedResponses), cache: new InMemoryCache(cacheConfig), }); @@ -952,7 +952,7 @@ describe('fetchMore on an observable query with connection', () => { request: { query: transformedQuery, variables: variablesMore }, result: resultMore, delay: 5, - }).setOnError(reject); + }); const client = new ApolloClient({ link, @@ -1011,7 +1011,7 @@ describe('fetchMore on an observable query with connection', () => { request: { query: transformedQuery, variables: variablesMore }, result: resultMore, delay: 5, - }).setOnError(reject); + }); const client = new ApolloClient({ link, diff --git a/src/__tests__/local-state/export.ts b/src/__tests__/local-state/export.ts index 45eac6ace1f..62402441d6a 100644 --- a/src/__tests__/local-state/export.ts +++ b/src/__tests__/local-state/export.ts @@ -371,7 +371,7 @@ describe('@client @export tests', () => { reviewerDetails, }, }); - }).setOnError(reject); + }); const cache = new InMemoryCache(); const client = new ApolloClient({ diff --git a/src/__tests__/mutationResults.ts b/src/__tests__/mutationResults.ts index 3da12270b34..f7484692a5c 100644 --- a/src/__tests__/mutationResults.ts +++ b/src/__tests__/mutationResults.ts @@ -156,7 +156,7 @@ describe('mutation results', () => { request: { query: queryWithTypename } as any, result, delay, - }, ...mockedResponses).setOnError(reject), + }, ...mockedResponses), cache: new InMemoryCache({ dataIdFromObject: (obj: any) => { if (obj.id && obj.__typename) { @@ -260,7 +260,7 @@ describe('mutation results', () => { result: { data: { mini: { id: 1, cover: 'image2', __typename: 'Mini' } }, }, - }).setOnError(reject); + }); interface Data { mini: { id: number; cover: string; __typename: string }; @@ -332,7 +332,7 @@ describe('mutation results', () => { }, }); observer.complete(); - })).setOnError(reject), + })), }); const mutation = gql` @@ -832,7 +832,7 @@ describe('mutation results', () => { }, { request: { query: resetMutation } as any, result: resetMutationResult, - }).setOnError(reject), + }), cache: new InMemoryCache({ addTypename: false }), }); @@ -1429,7 +1429,7 @@ describe('mutation results', () => { request: {query: mutation} as any, result: result1, - }).setOnError(reject), + }), cache: new InMemoryCache({addTypename: false}), }); diff --git a/src/__tests__/optimistic.ts b/src/__tests__/optimistic.ts index 9dd5bc74978..29325b92ca2 100644 --- a/src/__tests__/optimistic.ts +++ b/src/__tests__/optimistic.ts @@ -1281,7 +1281,7 @@ describe('optimistic mutation results', () => { request: { query: mutation }, result: mutationResult2, delay: 20, - }).setOnError(reject); + }); const customOptimisticResponse1 = { __typename: 'Mutation', @@ -1746,7 +1746,7 @@ describe('optimistic mutation results', () => { request: { query: mutation }, result: mutationResult2, delay: 20, - }).setOnError(reject); + }); const customOptimisticResponse1 = { __typename: 'Mutation', @@ -2221,7 +2221,7 @@ describe('optimistic mutation - githunt comments', () => { variables, }, result, - }, ...mockedResponses).setOnError(reject); + }, ...mockedResponses); const client = new ApolloClient({ link, diff --git a/src/__tests__/subscribeToMore.ts b/src/__tests__/subscribeToMore.ts index 3c5b4959ac1..42ceda2ca49 100644 --- a/src/__tests__/subscribeToMore.ts +++ b/src/__tests__/subscribeToMore.ts @@ -63,7 +63,7 @@ describe('subscribeToMore', () => { itAsync('triggers new result from subscription data', (resolve, reject) => { let latestResult: any = null; const wSLink = mockObservableLink(); - const httpLink = mockSingleLink(req1).setOnError(reject); + const httpLink = mockSingleLink(req1); const link = ApolloLink.split(isSub, wSLink, httpLink); let counter = 0; @@ -115,7 +115,7 @@ describe('subscribeToMore', () => { itAsync('calls error callback on error', (resolve, reject) => { let latestResult: any = null; const wSLink = mockObservableLink(); - const httpLink = mockSingleLink(req1).setOnError(reject); + const httpLink = mockSingleLink(req1); const link = ApolloLink.split(isSub, wSLink, httpLink); @@ -173,7 +173,7 @@ describe('subscribeToMore', () => { let latestResult: any = null; const wSLink = mockObservableLink(); - const httpLink = mockSingleLink(req1).setOnError(reject); + const httpLink = mockSingleLink(req1); const link = ApolloLink.split(isSub, wSLink, httpLink); @@ -232,7 +232,7 @@ describe('subscribeToMore', () => { itAsync('should not corrupt the cache (#3062)', async (resolve, reject) => { let latestResult: any = null; const wSLink = mockObservableLink(); - const httpLink = mockSingleLink(req4).setOnError(reject); + const httpLink = mockSingleLink(req4); const link = ApolloLink.split(isSub, wSLink, httpLink); let counter = 0; @@ -343,7 +343,7 @@ describe('subscribeToMore', () => { let latestResult: any = null; const wSLink = mockObservableLink(); - const httpLink = mockSingleLink(typedReq).setOnError(reject); + const httpLink = mockSingleLink(typedReq); const link = ApolloLink.split(isSub, wSLink, httpLink); let counter = 0; diff --git a/src/cache/inmemory/__tests__/policies.ts b/src/cache/inmemory/__tests__/policies.ts index dcf75babe1b..a86cac3e200 100644 --- a/src/cache/inmemory/__tests__/policies.ts +++ b/src/cache/inmemory/__tests__/policies.ts @@ -2580,7 +2580,7 @@ describe("type policies", function () { } }, } - ]).setOnError(reject); + ]); const client = new ApolloClient({ link, cache }); @@ -3002,7 +3002,7 @@ describe("type policies", function () { }, }, }, - ]).setOnError(reject); + ]); const client = new ApolloClient({ link, cache }); diff --git a/src/core/__tests__/ObservableQuery.ts b/src/core/__tests__/ObservableQuery.ts index c220cb36895..baaecc6e8c0 100644 --- a/src/core/__tests__/ObservableQuery.ts +++ b/src/core/__tests__/ObservableQuery.ts @@ -1306,7 +1306,7 @@ describe('ObservableQuery', () => { }, { request: { query: queryWithFragment, variables }, result: { data: dataTwoWithTypename }, - }).setOnError(reject); + }); const client = new ApolloClient({ link: ni, diff --git a/src/core/__tests__/QueryManager/index.ts b/src/core/__tests__/QueryManager/index.ts index e29ba0e1a21..90072ff9769 100644 --- a/src/core/__tests__/QueryManager/index.ts +++ b/src/core/__tests__/QueryManager/index.ts @@ -125,7 +125,7 @@ describe('QueryManager', () => { const link = mockSingleLink({ request: { query: mutation, variables }, result: { data, errors }, - }).setOnError(reject); + }); const queryManager = createQueryManager({ link, @@ -1471,7 +1471,7 @@ describe('QueryManager', () => { link: mockSingleLink({ request: { query: mutation }, result: { data }, - }).setOnError(reject), + }), config: { dataIdFromObject: getIdField }, }); @@ -1682,7 +1682,7 @@ describe('QueryManager', () => { link: mockSingleLink({ request: { query: transformedQuery }, result: { data: transformedQueryResult }, - }).setOnError(reject), + }), config: { addTypename: true }, }) .query({ query: query }) @@ -1723,7 +1723,7 @@ describe('QueryManager', () => { link: mockSingleLink({ request: { query: transformedMutation }, result: { data: transformedMutationResult }, - }).setOnError(reject), + }), config: { addTypename: true }, }) .mutate({ mutation: mutation }) @@ -2025,7 +2025,7 @@ describe('QueryManager', () => { }, { request: { query: query1 }, result: { data: data1 }, - }).setOnError(reject), + }), config: reducerConfig, }); @@ -2116,7 +2116,7 @@ describe('QueryManager', () => { }, { request: { query: query2 }, result: { data: data2 }, - }).setOnError(reject), + }), }); const observable1 = queryManager.watchQuery({ @@ -2449,7 +2449,7 @@ describe('QueryManager', () => { }, { request: { query: queryWithId }, result: { data: dataWithId }, - }).setOnError(reject), + }), config: { typePolicies: { Query: { @@ -2592,7 +2592,7 @@ describe('QueryManager', () => { link: mockSingleLink( { request: { query: queryA }, result: { data: dataA } }, { request: { query: queryB }, result: { data: dataB }, delay: 20 } - ).setOnError(reject), + ), cache: new InMemoryCache({}), ssrMode: true, }); @@ -2718,7 +2718,7 @@ describe('QueryManager', () => { }, { request: { query, variables }, result: { data: data2 }, - }).setOnError(reject), + }), cache: new InMemoryCache({ addTypename: false }), ssrMode: true, }); @@ -3225,7 +3225,7 @@ describe('QueryManager', () => { }, { request: { query: query2 }, result: { data: data2Changed }, - }).setOnError(reject), + }), }); const observable = queryManager.watchQuery({ query }); @@ -3256,7 +3256,7 @@ describe('QueryManager', () => { itAsync('should change the store state to an empty state', (resolve, reject) => { const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); queryManager.resetStore(); @@ -3525,7 +3525,7 @@ describe('QueryManager', () => { `; const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); const options = { @@ -3560,7 +3560,7 @@ describe('QueryManager', () => { `; const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); const options = { @@ -3683,7 +3683,7 @@ describe('QueryManager', () => { }, { request: { query: query2 }, result: { data: data2Changed }, - }).setOnError(reject), + }), }); const observable = queryManager.watchQuery({ query }); @@ -3926,7 +3926,7 @@ describe('QueryManager', () => { `; const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); const options = { @@ -3961,7 +3961,7 @@ describe('QueryManager', () => { `; const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); const options = { @@ -3996,7 +3996,7 @@ describe('QueryManager', () => { `; const queryManager = createQueryManager({ - link: mockSingleLink().setOnError(reject), + link: mockSingleLink(), }); const options = { @@ -5068,7 +5068,7 @@ describe('QueryManager', () => { { request: { query: query2 }, result: { data: { two: 2 } } }, { request: { query: query3 }, result: { data: { three: 3 } } }, { request: { query: query4 }, result: { data: { four: 4 } } } - ).setOnError(reject); + ); const cache = new InMemoryCache(); const queryManager = new QueryManager({ @@ -5124,7 +5124,7 @@ describe('QueryManager', () => { link: mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject), + }), }); const observable = queryManager.watchQuery({ @@ -5162,7 +5162,7 @@ describe('QueryManager', () => { const link = mockSingleLink({ request: { query }, result: { data }, - }).setOnError(reject); + }); const clientAwareness = { name: 'Test', diff --git a/src/core/__tests__/fetchPolicies.ts b/src/core/__tests__/fetchPolicies.ts index b67128eb701..941f06a479b 100644 --- a/src/core/__tests__/fetchPolicies.ts +++ b/src/core/__tests__/fetchPolicies.ts @@ -63,7 +63,7 @@ const createLink = (reject: (reason: any) => any) => }, { request: { query }, result: { data: result }, - }).setOnError(reject); + }); const createFailureLink = () => mockSingleLink({ @@ -87,7 +87,7 @@ const createMutationLink = (reject: (reason: any) => any) => { request: { query }, result: { data: merged }, - }).setOnError(reject); + }); describe('network-only', () => { itAsync('requests from the network even if already in cache', (resolve, reject) => { diff --git a/src/react/hooks/__tests__/useMutation.test.tsx b/src/react/hooks/__tests__/useMutation.test.tsx index de541810bb7..e2ee7273618 100644 --- a/src/react/hooks/__tests__/useMutation.test.tsx +++ b/src/react/hooks/__tests__/useMutation.test.tsx @@ -452,7 +452,7 @@ describe('useMutation Hook', () => { } ]; - const link = mockSingleLink(...mocks).setOnError(reject); + const link = mockSingleLink(...mocks); const cache = new InMemoryCache(); const client = new ApolloClient({ cache, diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx index f3b42d701d8..6379b82121c 100644 --- a/src/react/hooks/__tests__/useQuery.test.tsx +++ b/src/react/hooks/__tests__/useQuery.test.tsx @@ -361,7 +361,7 @@ describe('useQuery Hook', () => { } render( - + @@ -538,7 +538,7 @@ describe('useQuery Hook', () => { }; render( - + ); @@ -556,7 +556,7 @@ describe('useQuery Hook', () => { ...CAR_MOCKS, ]; - const mockLink = new MockLink(mocks).setOnError(reject); + const mockLink = new MockLink(mocks); const linkRequestSpy = jest.spyOn(mockLink, 'request'); @@ -628,7 +628,7 @@ describe('useQuery Hook', () => { const mocks = [...CAR_MOCKS, ...CAR_MOCKS]; unmount = render( - + ).unmount; @@ -847,7 +847,7 @@ describe('useQuery Hook', () => { mocks.push(...mocks); mocks.push(...mocks); - const link = new MockLink(mocks).setOnError(reject); + const link = new MockLink(mocks); let renderCount = 0; function App() {