Skip to content

Commit

Permalink
Fix tests affected by change to cache (#12330)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller authored Jan 31, 2025
1 parent f88e807 commit 0429fb9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
10 changes: 2 additions & 8 deletions .api-reports/api-report-testing_react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,7 @@ class ApolloError extends Error {
// (undocumented)
networkError: Error | ServerParseError | ServerError | null;
// (undocumented)
protocolErrors: ReadonlyArray<{
message: string;
extensions?: GraphQLErrorExtensions[];
}>;
protocolErrors: ReadonlyArray<GraphQLFormattedError>;
}

// @public (undocumented)
Expand All @@ -252,10 +249,7 @@ interface ApolloErrorOptions {
// (undocumented)
networkError?: Error | ServerParseError | ServerError | null;
// (undocumented)
protocolErrors?: ReadonlyArray<{
message: string;
extensions?: GraphQLErrorExtensions[];
}>;
protocolErrors?: ReadonlyArray<GraphQLFormattedError>;
}

// @public (undocumented)
Expand Down
1 change: 1 addition & 0 deletions knip.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const config = {
],
ignoreBinaries: ["jq"],
ignoreDependencies: [
/@actions\/.*/,
/@size-limit\/.*/,
/eslint-.*/,
// used by `recast`
Expand Down
2 changes: 1 addition & 1 deletion src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ interface MaskOperationOptions<TData> {
fetchPolicy?: WatchQueryFetchPolicy;
}

export interface QueryManagerOptions<TStore> {
interface QueryManagerOptions<TStore> {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions: DefaultOptions;
Expand Down
17 changes: 8 additions & 9 deletions src/core/__tests__/ObservableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ describe("ObservableQuery", () => {
await observable.refetch(variables2);

await expect(stream).toEmitApolloQueryResult({
// TODO: Ensure this value is undefined instead of an empty object
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -404,7 +403,7 @@ describe("ObservableQuery", () => {
});

await expect(stream).toEmitApolloQueryResult({
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -561,7 +560,7 @@ describe("ObservableQuery", () => {
await client.resetStore();

await expect(stream).toEmitApolloQueryResult({
data: {},
data: undefined,
loading: false,
networkStatus: NetworkStatus.ready,
partial: true,
Expand Down Expand Up @@ -825,7 +824,7 @@ describe("ObservableQuery", () => {
await expect(stream).toEmitApolloQueryResult({
// TODO: Fix this error
// @ts-expect-error `ApolloQueryResult` needs to be updated to allow for `undefined` and this value needs to emit undefined instead of empty object
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -1069,7 +1068,7 @@ describe("ObservableQuery", () => {
await expect(stream).toEmitApolloQueryResult({
// TODO: Fix this error
// @ts-expect-error Ensure ApolloQueryResult allows for undefined and fix this value to match
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -1120,7 +1119,7 @@ describe("ObservableQuery", () => {
await expect(stream).toEmitApolloQueryResult({
// TODO: Fix this error
// @ts-expect-error Need to update ApolloQueryResult to allow undefined and fix this value
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -1452,7 +1451,7 @@ describe("ObservableQuery", () => {
await observable.refetch(variables2);

await expect(stream).toEmitApolloQueryResult({
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down Expand Up @@ -1566,7 +1565,7 @@ describe("ObservableQuery", () => {
await observable.refetch(variables2);

await expect(stream).toEmitApolloQueryResult({
data: {},
data: undefined,
loading: true,
networkStatus: NetworkStatus.setVariables,
partial: true,
Expand Down

0 comments on commit 0429fb9

Please sign in to comment.