mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
fix: lint
This commit is contained in:
parent
388331f5ae
commit
b25bf7b0b3
@ -65,14 +65,19 @@ beforeEach(async() => {
|
|||||||
await cleanDatabase()
|
await cleanDatabase()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
describe('User', () => {
|
describe('User', () => {
|
||||||
describe('query by email address', () => {
|
describe('query by email address', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await Factory.build('user', { name: 'Johnny' }, { email: 'any-email-address@example.org' })
|
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' }
|
const variables = { email: 'any-email-address@example.org' }
|
||||||
|
|
||||||
it('is forbidden', async () => {
|
it('is forbidden', async () => {
|
||||||
@ -84,9 +89,11 @@ describe('User', () => {
|
|||||||
describe('as admin', () => {
|
describe('as admin', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const admin = await Factory.build(
|
const admin = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
role: 'admin',
|
role: 'admin',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'admin@example.org',
|
email: 'admin@example.org',
|
||||||
password: '1234',
|
password: '1234',
|
||||||
},
|
},
|
||||||
@ -119,8 +126,6 @@ describe('User', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe('UpdateUser', () => {
|
describe('UpdateUser', () => {
|
||||||
let variables
|
let variables
|
||||||
|
|
||||||
@ -154,13 +159,15 @@ describe('UpdateUser', () => {
|
|||||||
`
|
`
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
user = await Factory.build(
|
user = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
id: 'u47',
|
id: 'u47',
|
||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
termsAndConditionsAgreedVersion: null,
|
termsAndConditionsAgreedVersion: null,
|
||||||
termsAndConditionsAgreedAt: null,
|
termsAndConditionsAgreedAt: null,
|
||||||
allowEmbedIframes: false,
|
allowEmbedIframes: false,
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'user@example.org',
|
email: 'user@example.org',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -169,9 +176,11 @@ describe('UpdateUser', () => {
|
|||||||
describe('as another user', () => {
|
describe('as another user', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const someoneElse = await Factory.build(
|
const someoneElse = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
name: 'James Doe',
|
name: 'James Doe',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'someone-else@example.org',
|
email: 'someone-else@example.org',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -279,11 +288,12 @@ describe('Delete a user', () => {
|
|||||||
|
|
||||||
describe('as another user', () => {
|
describe('as another user', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|
||||||
anotherUser = await Factory.build(
|
anotherUser = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
role: 'user',
|
role: 'user',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'user@example.org',
|
email: 'user@example.org',
|
||||||
password: '1234',
|
password: '1234',
|
||||||
},
|
},
|
||||||
@ -300,11 +310,12 @@ describe('Delete a user', () => {
|
|||||||
|
|
||||||
describe('as moderator', () => {
|
describe('as moderator', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|
||||||
moderator = await Factory.build(
|
moderator = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
role: 'moderator',
|
role: 'moderator',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'moderator@example.org',
|
email: 'moderator@example.org',
|
||||||
password: '1234',
|
password: '1234',
|
||||||
},
|
},
|
||||||
@ -323,9 +334,11 @@ describe('Delete a user', () => {
|
|||||||
describe('authenticated as Admin', () => {
|
describe('authenticated as Admin', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
admin = await Factory.build(
|
admin = await Factory.build(
|
||||||
'user', {
|
'user',
|
||||||
|
{
|
||||||
role: 'admin',
|
role: 'admin',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
email: 'admin@example.org',
|
email: 'admin@example.org',
|
||||||
password: '1234',
|
password: '1234',
|
||||||
},
|
},
|
||||||
@ -346,27 +359,33 @@ describe('Delete a user', () => {
|
|||||||
icon: 'university',
|
icon: 'university',
|
||||||
})
|
})
|
||||||
await Factory.build(
|
await Factory.build(
|
||||||
'post', {
|
'post',
|
||||||
|
{
|
||||||
id: 'p139',
|
id: 'p139',
|
||||||
content: 'Post by user u343',
|
content: 'Post by user u343',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
author: user,
|
author: user,
|
||||||
categoryIds,
|
categoryIds,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
await Factory.build(
|
await Factory.build(
|
||||||
'comment', {
|
'comment',
|
||||||
|
{
|
||||||
id: 'c155',
|
id: 'c155',
|
||||||
content: 'Comment by user u343',
|
content: 'Comment by user u343',
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
author: user,
|
author: user,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
await Factory.build(
|
await Factory.build(
|
||||||
'comment', {
|
'comment',
|
||||||
|
{
|
||||||
id: 'c156',
|
id: 'c156',
|
||||||
content: "A comment by someone else on user u343's post",
|
content: "A comment by someone else on user u343's post",
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
postId: 'p139',
|
postId: 'p139',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -380,31 +399,37 @@ describe('Delete a user', () => {
|
|||||||
name: 'UNAVAILABLE',
|
name: 'UNAVAILABLE',
|
||||||
about: 'UNAVAILABLE',
|
about: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
contributions: [{
|
contributions: [
|
||||||
|
{
|
||||||
id: 'p139',
|
id: 'p139',
|
||||||
content: 'Post by user u343',
|
content: 'Post by user u343',
|
||||||
contentExcerpt: 'Post by user u343',
|
contentExcerpt: 'Post by user u343',
|
||||||
deleted: false,
|
deleted: false,
|
||||||
comments: [{
|
comments: [
|
||||||
|
{
|
||||||
id: 'c156',
|
id: 'c156',
|
||||||
content: "A comment by someone else on user u343's post",
|
content: "A comment by someone else on user u343's post",
|
||||||
contentExcerpt: "A comment by someone else on user u343's post",
|
contentExcerpt: "A comment by someone else on user u343's post",
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}, ],
|
},
|
||||||
}, ],
|
],
|
||||||
comments: [{
|
},
|
||||||
|
],
|
||||||
|
comments: [
|
||||||
|
{
|
||||||
id: 'c155',
|
id: 'c155',
|
||||||
content: 'Comment by user u343',
|
content: 'Comment by user u343',
|
||||||
contentExcerpt: 'Comment by user u343',
|
contentExcerpt: 'Comment by user u343',
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}, ],
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
}
|
}
|
||||||
await expect(mutate({ mutation: deleteUserMutation, variables })).resolves.toMatchObject(
|
await expect(
|
||||||
expectedResponse,
|
mutate({ mutation: deleteUserMutation, variables }),
|
||||||
)
|
).resolves.toMatchObject(expectedResponse)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('deletion of all post requested', () => {
|
describe('deletion of all post requested', () => {
|
||||||
@ -420,24 +445,30 @@ describe('Delete a user', () => {
|
|||||||
name: 'UNAVAILABLE',
|
name: 'UNAVAILABLE',
|
||||||
about: 'UNAVAILABLE',
|
about: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
contributions: [{
|
contributions: [
|
||||||
|
{
|
||||||
id: 'p139',
|
id: 'p139',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
comments: [{
|
comments: [
|
||||||
|
{
|
||||||
id: 'c156',
|
id: 'c156',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}, ],
|
},
|
||||||
}, ],
|
],
|
||||||
comments: [{
|
},
|
||||||
|
],
|
||||||
|
comments: [
|
||||||
|
{
|
||||||
id: 'c155',
|
id: 'c155',
|
||||||
content: 'Comment by user u343',
|
content: 'Comment by user u343',
|
||||||
contentExcerpt: 'Comment by user u343',
|
contentExcerpt: 'Comment by user u343',
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}, ],
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
@ -467,24 +498,30 @@ describe('Delete a user', () => {
|
|||||||
name: 'UNAVAILABLE',
|
name: 'UNAVAILABLE',
|
||||||
about: 'UNAVAILABLE',
|
about: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
contributions: [{
|
contributions: [
|
||||||
|
{
|
||||||
id: 'p139',
|
id: 'p139',
|
||||||
content: 'Post by user u343',
|
content: 'Post by user u343',
|
||||||
contentExcerpt: 'Post by user u343',
|
contentExcerpt: 'Post by user u343',
|
||||||
deleted: false,
|
deleted: false,
|
||||||
comments: [{
|
comments: [
|
||||||
|
{
|
||||||
id: 'c156',
|
id: 'c156',
|
||||||
content: "A comment by someone else on user u343's post",
|
content: "A comment by someone else on user u343's post",
|
||||||
contentExcerpt: "A comment by someone else on user u343's post",
|
contentExcerpt: "A comment by someone else on user u343's post",
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}, ],
|
},
|
||||||
}, ],
|
],
|
||||||
comments: [{
|
},
|
||||||
|
],
|
||||||
|
comments: [
|
||||||
|
{
|
||||||
id: 'c155',
|
id: 'c155',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}, ],
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
@ -508,24 +545,30 @@ describe('Delete a user', () => {
|
|||||||
name: 'UNAVAILABLE',
|
name: 'UNAVAILABLE',
|
||||||
about: 'UNAVAILABLE',
|
about: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
contributions: [{
|
contributions: [
|
||||||
|
{
|
||||||
id: 'p139',
|
id: 'p139',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
comments: [{
|
comments: [
|
||||||
|
{
|
||||||
id: 'c156',
|
id: 'c156',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}, ],
|
},
|
||||||
}, ],
|
],
|
||||||
comments: [{
|
},
|
||||||
|
],
|
||||||
|
comments: [
|
||||||
|
{
|
||||||
id: 'c155',
|
id: 'c155',
|
||||||
content: 'UNAVAILABLE',
|
content: 'UNAVAILABLE',
|
||||||
contentExcerpt: 'UNAVAILABLE',
|
contentExcerpt: 'UNAVAILABLE',
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}, ],
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user