This commit is contained in:
Robert Schäfer 2019-03-07 22:44:43 +01:00
parent 0529e2b2b0
commit f68e289016
2 changed files with 16 additions and 16 deletions

View File

@ -34,7 +34,7 @@ export default {
type: r.get('type')
}
})
if(!dbResponse) return null
if (!dbResponse) return null
const { report, submitter, resource, type } = dbResponse
let response = {
@ -45,16 +45,16 @@ export default {
submitter: submitter.properties,
type
}
switch(type){
case "Post":
response.post = resource.properties
break;
case "Comment":
response.comment = resource.properties
break;
case "User":
response.user = resource.properties
break;
switch (type) {
case 'Post':
response.post = resource.properties
break
case 'Comment':
response.comment = resource.properties
break
case 'User':
response.user = resource.properties
break
}
return response
}

View File

@ -64,7 +64,7 @@ describe('report', () => {
describe('valid resource id', () => {
beforeEach(async () => {
variables = {id: 'u2'}
variables = { id: 'u2' }
})
it('creates a report', async () => {
@ -98,8 +98,8 @@ describe('report', () => {
describe('reported resource is a post', () => {
beforeEach(async () => {
await factory.authenticateAs({email: 'test@example.org', password: '1234'})
await factory.create('Post', {id: 'p23', title: 'Matt and Robert having a pair-programming' })
await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
await factory.create('Post', { id: 'p23', title: 'Matt and Robert having a pair-programming' })
variables = { id: 'p23' }
})
@ -127,8 +127,8 @@ describe('report', () => {
describe('reported resource is a comment', () => {
beforeEach(async () => {
await factory.authenticateAs({email: 'test@example.org', password: '1234'})
await factory.create('Comment', {id: 'c34', content: 'Robert getting tired.' })
await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
await factory.create('Comment', { id: 'c34', content: 'Robert getting tired.' })
variables = { id: 'c34' }
})