Skip to content

Commit

Permalink
tests(server): Update elasticRelayConnection test for @elastic/elasti…
Browse files Browse the repository at this point in the history
…client 8.13.1
  • Loading branch information
nellh committed May 22, 2024
1 parent e63fc14 commit 9afe434
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ describe("dataset search resolvers", () => {
describe("elasticRelayConnection()", () => {
it("returns a relay cursor for empty ApiResponse", async () => {
const emptyApiResponse = {
body: {
hits: {
hits: [],
total: { value: 0 },
},
hits: {
hits: [],
total: { value: 0 },
},
}

Expand Down Expand Up @@ -60,20 +58,18 @@ describe("dataset search resolvers", () => {
}

const expectedApiResponse = {
body: {
hits: {
hits: [
{ _source: { id: "testdataset1" } },
{ _source: { id: "testdataset2" } },
{ _source: { id: "testdataset3" }, sort: [1] },
],
total: { value: 10 },
},
hits: {
hits: [
{ _source: { id: "testdataset1" } },
{ _source: { id: "testdataset2" } },
{ _source: { id: "testdataset3" }, sort: [1] },
],
total: { value: 10 },
},
}

const resultsRelayConnection = {
edges: expectedApiResponse.body.hits.hits.map((hit) => {
edges: expectedApiResponse.hits.hits.map((hit) => {
// This skips the dataset resolver logic and passes this back
mockResolvers.dataset.mockReturnValueOnce(hit._source)
return {
Expand Down

0 comments on commit 9afe434

Please sign in to comment.