More of @mattwr18's suggestions

This commit is contained in:
roschaefer 2019-09-03 15:51:18 +02:00
parent bb3f419532
commit 672f19e6d1
2 changed files with 7 additions and 8 deletions

View File

@ -344,7 +344,7 @@ describe('UpdatePost', () => {
it('allows a maximum of three category for a successful update', async () => { it('allows a maximum of three category for a successful update', async () => {
const { const {
errors: [error], errors: [error],
} = await mutate({ mutation: createPostMutation, variables }) } = await mutate({ mutation: updatePostMutation, variables })
expect(error).toHaveProperty( expect(error).toHaveProperty(
'message', 'message',
'You cannot save a post without at least one category or more than three', 'You cannot save a post without at least one category or more than three',
@ -375,7 +375,7 @@ describe('UpdatePost', () => {
const { const {
errors: [error], errors: [error],
} = await mutate({ } = await mutate({
mutation: createPostMutation, mutation: updatePostMutation,
variables: { variables: {
...variables, ...variables,
categoryIds: null, categoryIds: null,
@ -391,7 +391,7 @@ describe('UpdatePost', () => {
const { const {
errors: [error], errors: [error],
} = await mutate({ } = await mutate({
mutation: createPostMutation, mutation: updatePostMutation,
variables: { variables: {
...variables, ...variables,
categoryIds: [], categoryIds: [],

View File

@ -57,12 +57,11 @@ describe('User', () => {
describe('as admin', () => { describe('as admin', () => {
beforeEach(async () => { beforeEach(async () => {
const userParams = { const admin = await factory.create('User', {
role: 'admin', role: 'admin',
email: 'admin@example.org', email: 'admin@example.org',
password: '1234', password: '1234',
} })
const admin = await factory.create('User', userParams)
authenticatedUser = await admin.toJson() authenticatedUser = await admin.toJson()
}) })
@ -203,7 +202,7 @@ describe('DeleteUser', () => {
await factory.create('User', { await factory.create('User', {
email: 'friends-account@example.org', email: 'friends-account@example.org',
password: '1234', password: '1234',
id: 'u565', id: 'not-my-account',
}) })
}) })
@ -221,7 +220,7 @@ describe('DeleteUser', () => {
describe("attempting to delete another user's account", () => { describe("attempting to delete another user's account", () => {
beforeEach(() => { beforeEach(() => {
variables = { ...variables, id: 'u565' } variables = { ...variables, id: 'not-my-account' }
}) })
it('throws an authorization error', async () => { it('throws an authorization error', async () => {