Skip to content

Commit

Permalink
Update tests to use new APIs (#5730)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored May 17, 2021
1 parent 8deb8ec commit 3d80c64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions tests/api-tests/queries/relationships.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ multiAdapterRunners().map(({ runner, provider }) =>

// EVERY
const _users = await context.lists.User.findMany({
where: { feed_every: { title: { contains: 'J' } } },
where: { feed: { every: { title: { contains: 'J' } } } },
query: 'id name feed { id title }',
});

Expand All @@ -144,7 +144,7 @@ multiAdapterRunners().map(({ runner, provider }) =>

// SOME
const _users = await context.lists.User.findMany({
where: { feed_some: { title: { contains: 'J' } } },
where: { feed: { some: { title: { contains: 'J' } } } },
query: 'id feed(orderBy: [{ title: asc }]) { title }',
});

Expand Down Expand Up @@ -208,7 +208,7 @@ multiAdapterRunners().map(({ runner, provider }) =>

// EVERY
const _users = await context.lists.User.findMany({
where: { feed_every: { title: { contains: 'J' } } },
where: { feed: { every: { title: { contains: 'J' } } } },
query: 'id feed { id title }',
});

Expand All @@ -227,7 +227,7 @@ multiAdapterRunners().map(({ runner, provider }) =>

// SOME
const _users = await context.lists.User.findMany({
where: { feed_some: { title: { contains: 'J' } } },
where: { feed: { some: { title: { contains: 'J' } } } },
query: 'id name feed(orderBy: [{ title: asc }]) { id title }',
});

Expand Down Expand Up @@ -303,7 +303,7 @@ multiAdapterRunners().map(({ runner, provider }) =>

// SOME
const _users = await context.lists.User.findMany({
where: { feed_some: { author: { id: users[0].id } } },
where: { feed: { some: { author: { id: users[0].id } } } },
query: 'id name feed { id title }',
});
expect(_users).toEqual([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
['D', 0],
].map(async ([name, count]) => {
const users = await context.lists.User.findMany({
where: { friends_some: { name } },
where: { friends: { some: { name: { equals: name } } } },
});
expect(users.length).toEqual(count);
})
Expand All @@ -169,7 +169,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
['D', 4 + 7],
].map(async ([name, count]) => {
const users = await context.lists.User.findMany({
where: { friends_none: { name } },
where: { friends: { none: { name: { equals: name } } } },
});
expect(users.length).toEqual(count);
})
Expand All @@ -188,7 +188,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
['D', 1 + 7],
].map(async ([name, count]) => {
const users = await context.lists.User.findMany({
where: { friends_every: { name } },
where: { friends: { every: { name: { equals: name } } } },
});
expect(users.length).toEqual(count);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
type T = { id: IdType; notes: { id: IdType; title: string }[] };
const user = (await context.lists.User.findOne({
where: { id: alice.id },
query: 'id notes(sortBy: [{ title: asc }]) { id title }',
query: 'id notes(orderBy: [{ title: asc }]) { id title }',
})) as T;
expect(user).toEqual({ id: alice.id, notes: expect.any(Array) });
expect(user.notes.map(({ title }) => title)).toEqual(['A']);
Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/relationships/shared-names.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
runner(setupKeystone, async ({ context }) => {
await createInitialData(context);
const employees = await context.lists.Employee.findMany({
where: { company: { employees_some: { role: { name: 'RoleA' } } } },
where: { company: { employees: { some: { role: { name: 'RoleA' } } } } },
query: 'id name',
});
expect(employees).toHaveLength(1);
Expand Down

0 comments on commit 3d80c64

Please sign in to comment.