Skip to content

Commit

Permalink
prefer context.db.Task > graphql.raw
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens authored Oct 10, 2023
1 parent f16fa2b commit e356691
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions examples/testing/example-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,13 @@ test('Check access control by running updateTask as a specific user via context.

// test that we can update the task (with a session)
{
const { data, errors } = (await context
const result = (await context
.withSession({ listKey: 'User', itemId: alice.id, data: {} })
.graphql.raw({
query: `mutation update($id: ID!) {
updateTask(where: { id: $id }, data: { isComplete: true }) {
id
}
}`,
variables: { id: task.id },
})) as any;
assert.equal(data!.updateTask.id, task.id);
assert.equal(errors, undefined);
.db.Task.updateOne({
where: { id: task.id },
data: { isComplete: true }
});
assert.equal(result.id, task.id);
}

// test that we can't update the task (with an invalid session (Bob))
Expand Down

0 comments on commit e356691

Please sign in to comment.