mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
fix code review issues
This commit is contained in:
parent
ca970eb30a
commit
bdfc2127d5
@ -51,8 +51,8 @@ beforeEach(async () => {
|
||||
afterEach(async () => {
|
||||
await factory.cleanDatabase()
|
||||
})
|
||||
|
||||
describe('disable', () => {
|
||||
describe('moderate resources', () => {
|
||||
describe('disable', () => {
|
||||
const mutation = gql`
|
||||
mutation($id: ID!) {
|
||||
disable(id: $id)
|
||||
@ -61,7 +61,6 @@ describe('disable', () => {
|
||||
let variables
|
||||
|
||||
beforeEach(() => {
|
||||
// our defaul set of variables
|
||||
variables = {
|
||||
id: 'some-resource',
|
||||
}
|
||||
@ -71,8 +70,9 @@ describe('disable', () => {
|
||||
authenticatedUser = await currentUser.toJson()
|
||||
})
|
||||
it('throws authorization error', async () => {
|
||||
const { errors } = await mutate({ mutation, variables })
|
||||
expect(errors[0]).toHaveProperty('message', 'Not Authorised!')
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
errors: [{ message: 'Not Authorised!' }],
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('authenticated', () => {
|
||||
@ -89,8 +89,9 @@ describe('disable', () => {
|
||||
authenticatedUser = await nonModerator.toJson()
|
||||
})
|
||||
it('throws authorization error', async () => {
|
||||
const { errors } = await mutate({ mutation, variables })
|
||||
expect(errors[0]).toHaveProperty('message', 'Not Authorised!')
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
errors: [{ message: 'Not Authorised!' }],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -116,8 +117,9 @@ describe('disable', () => {
|
||||
})
|
||||
|
||||
it('returns null', async () => {
|
||||
const expected = { data: { disable: null } }
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject(expected)
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: { disable: null },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -142,8 +144,9 @@ describe('disable', () => {
|
||||
|
||||
it('returns disabled resource id', async () => {
|
||||
variables = { id: 'comment-id' }
|
||||
const expected = { data: { disable: 'comment-id' } }
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject(expected)
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: { disable: 'comment-id' },
|
||||
})
|
||||
})
|
||||
|
||||
it('changes .disabledBy', async () => {
|
||||
@ -225,7 +228,9 @@ describe('disable', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('enable', () => {
|
||||
// describe('authenticated', () => {
|
||||
// beforeEach(() => {
|
||||
// authenticateClient = setupAuthenticateClient({
|
||||
@ -233,7 +238,6 @@ describe('disable', () => {
|
||||
// password: '1234',
|
||||
// })
|
||||
// })
|
||||
|
||||
// describe('enable', () => {
|
||||
// const mutation = gql`
|
||||
// mutation($id: ID!) {
|
||||
@ -243,19 +247,16 @@ describe('disable', () => {
|
||||
// const action = async () => {
|
||||
// return client.request(mutation, variables)
|
||||
// }
|
||||
|
||||
// beforeEach(() => {
|
||||
// our default set of variables
|
||||
// variables = {
|
||||
// id: 'blabla',
|
||||
// }
|
||||
// })
|
||||
|
||||
// it('throws authorization error', async () => {
|
||||
// await setup()
|
||||
// await expect(action()).rejects.toThrow('Not Authorised')
|
||||
// })
|
||||
|
||||
// describe('authenticated', () => {
|
||||
// beforeEach(() => {
|
||||
// authenticateClient = setupAuthenticateClient({
|
||||
@ -409,4 +410,5 @@ describe('disable', () => {
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user