Skip to content

Commit

Permalink
Add failing test for watchFragment with non-identifiable object
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 14, 2024
1 parent bcedcad commit e032398
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/__tests__/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,36 @@ describe("ApolloClient", () => {
});
}
});

it("reports complete as false when `from` is not identifiable", async () => {
const cache = new InMemoryCache();
const client = new ApolloClient({
cache,
link: ApolloLink.empty(),
});
const ItemFragment = gql`
fragment ItemFragment on Item {
id
text
}
`;

const observable = client.watchFragment({
fragment: ItemFragment,
from: {},
});

const stream = new ObservableStream(observable);

{
const result = await stream.takeNext();

expect(result).toStrictEqual({
data: {},
complete: false,
});
}
});
});

describe("defaultOptions", () => {
Expand Down

0 comments on commit e032398

Please sign in to comment.