Skip to content

Commit

Permalink
Update more tests to new APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie committed May 14, 2021
1 parent e5ae2c9 commit 6560cea
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
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

0 comments on commit 6560cea

Please sign in to comment.