From f9ab7a2f9f2f2524b238808a4ae646d88125296e Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 8 Mar 2023 17:14:56 -0500 Subject: [PATCH] Test full cache.extract() at end of test. https://github.com/apollographql/apollo-client/pull/10633#discussion_r1129985422 --- src/cache/inmemory/__tests__/policies.ts | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/cache/inmemory/__tests__/policies.ts b/src/cache/inmemory/__tests__/policies.ts index 14cc2b78e2f..11ac14dcb16 100644 --- a/src/cache/inmemory/__tests__/policies.ts +++ b/src/cache/inmemory/__tests__/policies.ts @@ -757,6 +757,50 @@ describe("type policies", function () { { __typename: "ManagerEntity", uid: "vbnm", name: "Hugh" }, ], }); + + expect(cache.extract()).toEqual({ + ROOT_QUERY: { + __typename: "Query", + coworkers: [ + { __ref: 'CoworkerEntity:{"uid":"qwer"}' }, + { __ref: 'CoworkerEntity:{"uid":"asdf"}' }, + { __ref: 'CoworkerEntity:{"uid":"zxcv"}' }, + { __ref: 'ManagerEntity:{"uid":"uiop"}' }, + { __ref: 'CoworkerEntity:{"uid":"hjkl"}' }, + { __ref: 'ManagerEntity:{"uid":"vbnm"}' }, + ], + }, + 'CoworkerEntity:{"uid":"qwer"}': { + __typename: "CoworkerEntity", + uid: "qwer", + name: "Alessia", + }, + 'CoworkerEntity:{"uid":"asdf"}': { + __typename: "CoworkerEntity", + uid: "asdf", + name: "Jerel", + }, + 'CoworkerEntity:{"uid":"zxcv"}': { + __typename: "CoworkerEntity", + uid: "zxcv", + name: "Lenz", + }, + 'ManagerEntity:{"uid":"uiop"}': { + __typename: "ManagerEntity", + uid: "uiop", + name: "Jeff", + }, + 'CoworkerEntity:{"uid":"hjkl"}': { + __typename: "CoworkerEntity", + uid: "hjkl", + name: "Martijn", + }, + 'ManagerEntity:{"uid":"vbnm"}': { + __typename: "ManagerEntity", + uid: "vbnm", + name: "Hugh", + }, + }); }); describe("field policies", function () {