Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update more tests to new APIs #5703

Merged
merged 1 commit into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/api-tests/access-control/authed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ multiAdapterRunners().map(({ before, after, provider }) =>
for (const [listKey, _items] of Object.entries(initialData)) {
items[listKey] = (await context.lists[listKey].createMany({
data: _items.map(x => ({ data: x })),
query: 'id, name',
query: 'id name',
})) as { id: IdType; name: string }[];
}
user = (await context.lists.User.createOne({
Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/access-control/updateMany.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
})) as { id: any }[];
// Attempt to update all four items
const _users = await context.exitSudo().lists.User.updateMany({
data: users.map(({ id }) => ({ id, data: { name: 'new name' } })),
data: users.map(({ id }) => ({ where: { id }, data: { name: 'new name' } })),
query: 'id name isUpdatable',
});
// We don't expect an error, but only two of the items should get updated and returned
Expand Down
8 changes: 4 additions & 4 deletions tests/api-tests/access-control/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function setupKeystone(provider: ProviderName) {
User: list({
fields: {
name: text(),
email: text(),
email: text({ index: 'unique' }),
password: password(),
noRead: text({ access: { read: () => false } }),
yesRead: text({ access: { read: () => true } }),
Expand Down Expand Up @@ -127,9 +127,9 @@ function setupKeystone(provider: ProviderName) {
access: {
create: access.create,
// arbitrarily restrict the data to a single item (see data.js)
read: () => access.read && { name: 'Hello' },
update: () => access.update && { name: 'Hello' },
delete: () => access.delete && { name: 'Hello' },
read: () => access.read && { name: { equals: 'Hello' } },
update: () => access.update && { name: { equals: 'Hello' } },
delete: () => access.delete && { name: { equals: 'Hello' } },
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/auth-header.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function setupKeystone(provider: ProviderName) {
User: list({
fields: {
name: text(),
email: text(),
email: text({ index: 'unique' }),
password: password(),
},
access: {
Expand Down
4 changes: 2 additions & 2 deletions tests/api-tests/queries/cache-hints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
app,
query: `
query {
allUsers(where: { name: "nope" }) {
allUsers(where: { name: { equals: "nope" } }) {
name
}
}
Expand Down Expand Up @@ -303,7 +303,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
query: `
query {
allPosts {
author(where: { name: "nope" }) {
author(where: { name: { equals: "nope" } }) {
name
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/api-tests/queries/limits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
query: `
query {
allUsers(
where: { name: "Nope" }
where: { name: { equals: "Nope" } }
) {
name
}
Expand Down Expand Up @@ -139,7 +139,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
query: `
query {
allUsers(
where: { name: "Nope" },
where: { name: { equals: "Nope" } },
first: 100000
) {
name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
const data1 = await context.graphql.run({
query: `
query {
all${group.name}s(where: { name: "${groupName}" }) {
all${group.name}s(where: { name: { equals: "${groupName}" } }) {
id
name
}
Expand Down Expand Up @@ -353,7 +353,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
const data2 = await context.graphql.run({
query: `
query {
all${group.name}s(where: { name: "${groupName}" }) {
all${group.name}s(where: { name: { equals: "${groupName}" } }) {
id
name
}
Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/server-side-graphql-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ multiAdapterRunners().map(({ runner, provider }) =>
context,
listKey,
returnFields,
where: { name: 'test15' },
where: { name: { equals: 'test15' } },
});

expect(allItems).toEqual([{ name: 'test15', age: 150 }]);
Expand Down