fix: lint

This commit is contained in:
ogerly 2020-08-03 15:22:21 +02:00
parent 388331f5ae
commit b25bf7b0b3

View File

@ -65,14 +65,19 @@ beforeEach(async() => {
await cleanDatabase()
})
describe('User', () => {
describe('query by email address', () => {
beforeEach(async () => {
await Factory.build('user', { name: 'Johnny' }, { email: 'any-email-address@example.org' })
})
const userQuery = gql `query($email: String) { User(email: $email) { name } }`
const userQuery = gql`
query($email: String) {
User(email: $email) {
name
}
}
`
const variables = { email: 'any-email-address@example.org' }
it('is forbidden', async () => {
@ -84,9 +89,11 @@ describe('User', () => {
describe('as admin', () => {
beforeEach(async () => {
const admin = await Factory.build(
'user', {
'user',
{
role: 'admin',
}, {
},
{
email: 'admin@example.org',
password: '1234',
},
@ -119,8 +126,6 @@ describe('User', () => {
})
})
describe('UpdateUser', () => {
let variables
@ -154,13 +159,15 @@ describe('UpdateUser', () => {
`
beforeEach(async () => {
user = await Factory.build(
'user', {
'user',
{
id: 'u47',
name: 'John Doe',
termsAndConditionsAgreedVersion: null,
termsAndConditionsAgreedAt: null,
allowEmbedIframes: false,
}, {
},
{
email: 'user@example.org',
},
)
@ -169,9 +176,11 @@ describe('UpdateUser', () => {
describe('as another user', () => {
beforeEach(async () => {
const someoneElse = await Factory.build(
'user', {
'user',
{
name: 'James Doe',
}, {
},
{
email: 'someone-else@example.org',
},
)
@ -279,11 +288,12 @@ describe('Delete a user', () => {
describe('as another user', () => {
beforeEach(async () => {
anotherUser = await Factory.build(
'user', {
'user',
{
role: 'user',
}, {
},
{
email: 'user@example.org',
password: '1234',
},
@ -300,11 +310,12 @@ describe('Delete a user', () => {
describe('as moderator', () => {
beforeEach(async () => {
moderator = await Factory.build(
'user', {
'user',
{
role: 'moderator',
}, {
},
{
email: 'moderator@example.org',
password: '1234',
},
@ -323,9 +334,11 @@ describe('Delete a user', () => {
describe('authenticated as Admin', () => {
beforeEach(async () => {
admin = await Factory.build(
'user', {
'user',
{
role: 'admin',
}, {
},
{
email: 'admin@example.org',
password: '1234',
},
@ -346,27 +359,33 @@ describe('Delete a user', () => {
icon: 'university',
})
await Factory.build(
'post', {
'post',
{
id: 'p139',
content: 'Post by user u343',
}, {
},
{
author: user,
categoryIds,
},
)
await Factory.build(
'comment', {
'comment',
{
id: 'c155',
content: 'Comment by user u343',
}, {
},
{
author: user,
},
)
await Factory.build(
'comment', {
'comment',
{
id: 'c156',
content: "A comment by someone else on user u343's post",
}, {
},
{
postId: 'p139',
},
)
@ -380,31 +399,37 @@ describe('Delete a user', () => {
name: 'UNAVAILABLE',
about: 'UNAVAILABLE',
deleted: true,
contributions: [{
contributions: [
{
id: 'p139',
content: 'Post by user u343',
contentExcerpt: 'Post by user u343',
deleted: false,
comments: [{
comments: [
{
id: 'c156',
content: "A comment by someone else on user u343's post",
contentExcerpt: "A comment by someone else on user u343's post",
deleted: false,
}, ],
}, ],
comments: [{
},
],
},
],
comments: [
{
id: 'c155',
content: 'Comment by user u343',
contentExcerpt: 'Comment by user u343',
deleted: false,
}, ],
},
],
},
},
errors: undefined,
}
await expect(mutate({ mutation: deleteUserMutation, variables })).resolves.toMatchObject(
expectedResponse,
)
await expect(
mutate({ mutation: deleteUserMutation, variables }),
).resolves.toMatchObject(expectedResponse)
})
describe('deletion of all post requested', () => {
@ -420,24 +445,30 @@ describe('Delete a user', () => {
name: 'UNAVAILABLE',
about: 'UNAVAILABLE',
deleted: true,
contributions: [{
contributions: [
{
id: 'p139',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
comments: [{
comments: [
{
id: 'c156',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
}, ],
}, ],
comments: [{
},
],
},
],
comments: [
{
id: 'c155',
content: 'Comment by user u343',
contentExcerpt: 'Comment by user u343',
deleted: false,
}, ],
},
],
},
},
errors: undefined,
@ -467,24 +498,30 @@ describe('Delete a user', () => {
name: 'UNAVAILABLE',
about: 'UNAVAILABLE',
deleted: true,
contributions: [{
contributions: [
{
id: 'p139',
content: 'Post by user u343',
contentExcerpt: 'Post by user u343',
deleted: false,
comments: [{
comments: [
{
id: 'c156',
content: "A comment by someone else on user u343's post",
contentExcerpt: "A comment by someone else on user u343's post",
deleted: false,
}, ],
}, ],
comments: [{
},
],
},
],
comments: [
{
id: 'c155',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
}, ],
},
],
},
},
errors: undefined,
@ -508,24 +545,30 @@ describe('Delete a user', () => {
name: 'UNAVAILABLE',
about: 'UNAVAILABLE',
deleted: true,
contributions: [{
contributions: [
{
id: 'p139',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
comments: [{
comments: [
{
id: 'c156',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
}, ],
}, ],
comments: [{
},
],
},
],
comments: [
{
id: 'c155',
content: 'UNAVAILABLE',
contentExcerpt: 'UNAVAILABLE',
deleted: true,
}, ],
},
],
},
},
errors: undefined,