Skip to content

Commit

Permalink
test: Test relation query with overlapping relation matches and pagin…
Browse files Browse the repository at this point in the history
…ation (doug-martin#954)
  • Loading branch information
mwoelk committed Mar 10, 2021
1 parent b1c8444 commit 473408d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions examples/basic/e2e/todo-item.resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,48 @@ describe('TodoItemResolver (basic - e2e)', () => {
]);
}));

it(`should allow querying relations with overlapping matches on the results and correct pagination (issue 954)`, () =>
request(app.getHttpServer())
.post('/graphql')
.send({
operationName: null,
variables: {},
query: `{
todoItems(
paging: {first: 2}
filter: {
or: [
{ id: { eq: 2 } },
{ subTasks: { title: { like: "Create Nest App%" } } }
]
}
) {
edges {
node {
id
title
}
}
}
}`,
})
.expect(200)
.then(({ body }) => {
const { edges }: CursorConnectionType<TodoItemDTO> = body.data.todoItems;
expect(edges).toHaveLength(2);

expect(edges.map((e) => e.node)).toEqual([
{
id: '1',
title: 'Create Nest App',
},
{
id: '2',
title: 'Create Entity',
},
]);
}));

it(`should allow sorting`, () =>
request(app.getHttpServer())
.post('/graphql')
Expand Down

0 comments on commit 473408d

Please sign in to comment.