Major Changes
-
#12639
1bdf489
Thanks @jerelmiller! - Move internal testing utilities in@apollo/client/testing
to@apollo/client/testing/internal
and remove deprecated testing utilities. Some of the testing utilities exported from the@apollo/client/testing
endpoint were not considered stable. As a result of this change, testing utilities or types exported from@apollo/client/testing
are now considered stable and will not undergo breaking changes.The following APIs were removed. To migrate, update usages of the following APIs as such:
createMockClient
- const client = createMockClient(data, query, variables); + const client = new ApolloClient({ + cache: new InMemoryCache(), + link: new MockLink([ + { + request: { query, variables }, + result: { data }, + } + ]), + });
mockObservableLink
- const link = mockObservableLink(); + const link = new MockSubscriptionLink();
mockSingleLink
- const link = mockSingleLink({ - request: { query, variables }, - result: { data }, - }); + const link = new MockLink([ + { + request: { query, variables }, + result: { data }, + } + ]);
-
#12637
d2a60d4
Thanks @phryneas! -useQuery
: only advancepreviousData
ifdata
actually changed -
#12631
b147cac
Thanks @phryneas! -ObservableQuery
will now return aloading: false
state forfetchPolicy
standby
, even before subscription -
#12639
1bdf489
Thanks @jerelmiller! - Remove the@apollo/client/testing/core
entrypoint in favor of@apollo/client/testing
.
Minor Changes
-
#12639
1bdf489
Thanks @jerelmiller! - MoveMockLink
types toMockLink
namespace. This affects theMockedResponse
,MockLinkOptions
, andResultFunction
types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on theMockLink
namespace instead.import { - MockedResponse, - MockLinkOptions, - ResultFunction, + MockLink } from "@apollo/client/testing"; - const mocks: MockedResponse = []; + const mocks: MockLink.MockedResponse = []; - const result: ResultFunction = () => {/* ... */ } + const result: MockLink.ResultFunction = () => {/* ... */ } - const options: MockLinkOptions = {} + const options: MockLink.Options = {}