mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Lint fixes
This commit is contained in:
parent
68980f85c6
commit
f9fe4f742f
@ -84,7 +84,7 @@ export default {
|
||||
`
|
||||
await this.$apollo.mutate({
|
||||
mutation: gqlMutation,
|
||||
variables: { id: this.comment.id }
|
||||
variables: { id: this.comment.id },
|
||||
})
|
||||
this.$toast.success(this.$t(`delete.comment.success`))
|
||||
this.$emit('deleteComment')
|
||||
@ -92,6 +92,6 @@ export default {
|
||||
this.$toast.error(err.message)
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -59,7 +59,7 @@ export default {
|
||||
required: true,
|
||||
validator: value => {
|
||||
return value.match(/(contribution|comment|organization|user)/)
|
||||
}
|
||||
},
|
||||
},
|
||||
callbacks: { type: Object, required: true },
|
||||
},
|
||||
@ -101,7 +101,7 @@ export default {
|
||||
callback: () => {
|
||||
this.openModal('delete')
|
||||
},
|
||||
icon: 'trash'
|
||||
icon: 'trash',
|
||||
})
|
||||
}
|
||||
|
||||
@ -153,8 +153,8 @@ export default {
|
||||
data: {
|
||||
type: this.resourceType,
|
||||
resource: this.resource,
|
||||
callbacks: this.callbacks
|
||||
}
|
||||
callbacks: this.callbacks,
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@ -24,7 +24,7 @@ describe('DeleteModal.vue', () => {
|
||||
id: 'p23',
|
||||
callbacks: {
|
||||
confirm: () => Post.methods.deletePostCallback('list'),
|
||||
cancel: null
|
||||
cancel: null,
|
||||
},
|
||||
}
|
||||
mocks = {
|
||||
@ -65,7 +65,7 @@ describe('DeleteModal.vue', () => {
|
||||
name: 'It is a post',
|
||||
callbacks: {
|
||||
confirm: () => Post.methods.deletePostCallback('list'),
|
||||
cancel: null
|
||||
cancel: null,
|
||||
},
|
||||
}
|
||||
})
|
||||
@ -73,9 +73,7 @@ describe('DeleteModal.vue', () => {
|
||||
it('mentions post title', () => {
|
||||
Wrapper()
|
||||
const calls = mocks.$t.mock.calls
|
||||
const expected = [
|
||||
['delete.contribution.message', { name: 'It is a post' }]
|
||||
]
|
||||
const expected = [['delete.contribution.message', { name: 'It is a post' }]]
|
||||
expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
})
|
||||
})
|
||||
@ -88,17 +86,15 @@ describe('DeleteModal.vue', () => {
|
||||
name: 'It is the user of the comment',
|
||||
callbacks: {
|
||||
confirm: () => Post.methods.deletePostCallback('list'),
|
||||
cancel: null
|
||||
}
|
||||
cancel: null,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
it('mentions comments user name', () => {
|
||||
Wrapper()
|
||||
const calls = mocks.$t.mock.calls
|
||||
const expected = [
|
||||
['delete.comment.message', { name: 'It is the user of the comment' }]
|
||||
]
|
||||
const expected = [['delete.comment.message', { name: 'It is the user of the comment' }]]
|
||||
expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
})
|
||||
})
|
||||
@ -122,7 +118,7 @@ describe('DeleteModal.vue', () => {
|
||||
id: 'p23',
|
||||
callbacks: {
|
||||
confirm: () => Post.methods.deletePostCallback('list'),
|
||||
cancel: null
|
||||
cancel: null,
|
||||
},
|
||||
}
|
||||
wrapper = Wrapper()
|
||||
@ -195,8 +191,8 @@ describe('DeleteModal.vue', () => {
|
||||
id: 'c3',
|
||||
callbacks: {
|
||||
confirm: () => Post.methods.deletePostCallback('list'),
|
||||
cancel: null
|
||||
}
|
||||
cancel: null,
|
||||
},
|
||||
}
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async cancel() {
|
||||
if (!!this.callbacks.cancel) {
|
||||
if (this.callbacks.cancel) {
|
||||
await this.callbacks.cancel()
|
||||
}
|
||||
this.isOpen = false
|
||||
@ -85,7 +85,7 @@ export default {
|
||||
async confirm() {
|
||||
this.loading = true
|
||||
try {
|
||||
if (!!this.callbacks.confirm) {
|
||||
if (this.callbacks.confirm) {
|
||||
await this.callbacks.confirm()
|
||||
}
|
||||
this.success = true
|
||||
|
||||
@ -55,7 +55,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async cancel() {
|
||||
if (!!this.callbacks.cancel) {
|
||||
if (this.callbacks.cancel) {
|
||||
await this.callbacks.cancel()
|
||||
}
|
||||
this.isOpen = false
|
||||
@ -65,7 +65,7 @@ export default {
|
||||
},
|
||||
async confirm() {
|
||||
try {
|
||||
if (!!this.callbacks.confirm) {
|
||||
if (this.callbacks.confirm) {
|
||||
await this.callbacks.confirm()
|
||||
}
|
||||
await this.$apollo.mutate({
|
||||
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async cancel() {
|
||||
if (!!this.callbacks.cancel) {
|
||||
if (this.callbacks.cancel) {
|
||||
await this.callbacks.cancel()
|
||||
}
|
||||
this.isOpen = false
|
||||
@ -85,7 +85,7 @@ export default {
|
||||
async confirm() {
|
||||
this.loading = true
|
||||
try {
|
||||
if (!!this.callbacks.confirm) {
|
||||
if (this.callbacks.confirm) {
|
||||
await this.callbacks.confirm()
|
||||
}
|
||||
await this.$apollo.mutate({
|
||||
|
||||
@ -102,7 +102,7 @@ export default {
|
||||
},
|
||||
width: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
||||
@ -14,7 +14,7 @@ export default {
|
||||
`
|
||||
await this.$apollo.mutate({
|
||||
mutation: gqlMutation,
|
||||
variables: { id: this.post.id }
|
||||
variables: { id: this.post.id },
|
||||
})
|
||||
this.$toast.success(this.$t(`delete.contribution.success`))
|
||||
switch (postDisplayType) {
|
||||
@ -30,6 +30,6 @@ export default {
|
||||
} catch (err) {
|
||||
this.$toast.error(err.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
|
||||
import Methods from '~/mixins/PostMutationHelpers'
|
||||
|
||||
const {
|
||||
methods: { deletePostCallback }
|
||||
methods: { deletePostCallback },
|
||||
} = Methods
|
||||
// console.log(deletePostCallback())
|
||||
|
||||
@ -12,26 +12,26 @@ describe('PostMutationHelpers.js', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
post = {
|
||||
id: 'p23'
|
||||
id: 'p23',
|
||||
}
|
||||
mocks = {
|
||||
$t: jest.fn(),
|
||||
$filters: {
|
||||
truncate: a => a
|
||||
truncate: a => a,
|
||||
},
|
||||
$emit: jest.fn(),
|
||||
$router: {
|
||||
history: {
|
||||
push: jest.fn()
|
||||
}
|
||||
push: jest.fn(),
|
||||
},
|
||||
},
|
||||
$toast: {
|
||||
success: () => {},
|
||||
error: () => {}
|
||||
error: () => {},
|
||||
},
|
||||
$apollo: {
|
||||
mutate: jest.fn().mockResolvedValue()
|
||||
}
|
||||
mutate: jest.fn().mockResolvedValue(),
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ export default {
|
||||
methods: {
|
||||
deletePost(index) {
|
||||
this.post.relatedContributions.splice(index, 1)
|
||||
}
|
||||
},
|
||||
},
|
||||
apollo: {
|
||||
Post: {
|
||||
|
||||
@ -24,7 +24,7 @@ describe('PostSlug', () => {
|
||||
propsData = {}
|
||||
mocks = {
|
||||
post: {
|
||||
id: 'p23'
|
||||
id: 'p23',
|
||||
},
|
||||
$t: jest.fn(),
|
||||
// $filters: {
|
||||
@ -32,29 +32,29 @@ describe('PostSlug', () => {
|
||||
// },
|
||||
$toast: {
|
||||
success: () => {},
|
||||
error: () => {}
|
||||
error: () => {},
|
||||
},
|
||||
$apollo: {
|
||||
mutate: jest.fn().mockResolvedValue()
|
||||
}
|
||||
mutate: jest.fn().mockResolvedValue(),
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
// describe('shallowMount', () => {
|
||||
// Wrapper = () => {
|
||||
// return shallowMount(PostSlug, { propsData, mocks, localVue, router })
|
||||
// }
|
||||
// describe('shallowMount', () => {
|
||||
// Wrapper = () => {
|
||||
// return shallowMount(PostSlug, { propsData, mocks, localVue, router })
|
||||
// }
|
||||
|
||||
// describe('defaults', () => {
|
||||
// it('success false', () => {
|
||||
// console.log(Wrapper().vm)
|
||||
// expect(Wrapper().vm.success).toBe(false)
|
||||
// })
|
||||
// describe('defaults', () => {
|
||||
// it('success false', () => {
|
||||
// console.log(Wrapper().vm)
|
||||
// expect(Wrapper().vm.success).toBe(false)
|
||||
// })
|
||||
|
||||
// it('loading false', () => {
|
||||
// expect(Wrapper().vm.loading).toBe(false)
|
||||
// })
|
||||
// })
|
||||
// it('loading false', () => {
|
||||
// expect(Wrapper().vm.loading).toBe(false)
|
||||
// })
|
||||
// })
|
||||
|
||||
// describe('given a post', () => {
|
||||
// beforeEach(() => {
|
||||
@ -101,7 +101,7 @@ describe('PostSlug', () => {
|
||||
// expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
|
||||
describe('mount', () => {
|
||||
Wrapper = () => {
|
||||
@ -169,75 +169,75 @@ describe('PostSlug', () => {
|
||||
// })
|
||||
// })
|
||||
|
||||
// describe('click confirm button and delete the post', () => {
|
||||
// beforeEach(() => {
|
||||
// wrapper.find('button.confirm').trigger('click')
|
||||
// })
|
||||
// describe('click confirm button and delete the post', () => {
|
||||
// beforeEach(() => {
|
||||
// wrapper.find('button.confirm').trigger('click')
|
||||
// })
|
||||
|
||||
// it('calls delete mutation', () => {
|
||||
// expect(mocks.$apollo.mutate).toHaveBeenCalled()
|
||||
// })
|
||||
// it('calls delete mutation', () => {
|
||||
// expect(mocks.$apollo.mutate).toHaveBeenCalled()
|
||||
// })
|
||||
|
||||
// it('sets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(true)
|
||||
// })
|
||||
// it('sets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(true)
|
||||
// })
|
||||
|
||||
// it('displays a success message', () => {
|
||||
// const calls = mocks.$t.mock.calls
|
||||
// const expected = [['delete.contribution.success']]
|
||||
// expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
// })
|
||||
// it('displays a success message', () => {
|
||||
// const calls = mocks.$t.mock.calls
|
||||
// const expected = [['delete.contribution.success']]
|
||||
// expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
// })
|
||||
|
||||
// describe('after timeout', () => {
|
||||
// beforeEach(jest.runAllTimers)
|
||||
// describe('after timeout', () => {
|
||||
// beforeEach(jest.runAllTimers)
|
||||
|
||||
// it('fades away', () => {
|
||||
// expect(wrapper.vm.isOpen).toBe(false)
|
||||
// })
|
||||
// it('fades away', () => {
|
||||
// expect(wrapper.vm.isOpen).toBe(false)
|
||||
// })
|
||||
|
||||
// it('emits close', () => {
|
||||
// expect(wrapper.emitted().close).toBeTruthy()
|
||||
// })
|
||||
// it('emits close', () => {
|
||||
// expect(wrapper.emitted().close).toBeTruthy()
|
||||
// })
|
||||
|
||||
// it('resets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(false)
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// it('resets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(false)
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
// describe('given comment id', () => {
|
||||
// beforeEach(() => {
|
||||
// propsData = {
|
||||
// type: 'comment',
|
||||
// id: 'c3'
|
||||
// // callbacks: {
|
||||
// // confirm: () => Post.methods.deletePostCallback('list'),
|
||||
// // cancel: null
|
||||
// // }
|
||||
// }
|
||||
// wrapper = Wrapper()
|
||||
// })
|
||||
// describe('given comment id', () => {
|
||||
// beforeEach(() => {
|
||||
// propsData = {
|
||||
// type: 'comment',
|
||||
// id: 'c3'
|
||||
// // callbacks: {
|
||||
// // confirm: () => Post.methods.deletePostCallback('list'),
|
||||
// // cancel: null
|
||||
// // }
|
||||
// }
|
||||
// wrapper = Wrapper()
|
||||
// })
|
||||
|
||||
// describe('click confirm button and delete the comment', () => {
|
||||
// beforeEach(() => {
|
||||
// wrapper.find('button.confirm').trigger('click')
|
||||
// })
|
||||
// describe('click confirm button and delete the comment', () => {
|
||||
// beforeEach(() => {
|
||||
// wrapper.find('button.confirm').trigger('click')
|
||||
// })
|
||||
|
||||
// it('calls delete mutation', () => {
|
||||
// expect(mocks.$apollo.mutate).toHaveBeenCalled()
|
||||
// })
|
||||
// it('calls delete mutation', () => {
|
||||
// expect(mocks.$apollo.mutate).toHaveBeenCalled()
|
||||
// })
|
||||
|
||||
// it('sets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(true)
|
||||
// })
|
||||
// it('sets success', () => {
|
||||
// expect(wrapper.vm.success).toBe(true)
|
||||
// })
|
||||
|
||||
// it('displays a success message', () => {
|
||||
// const calls = mocks.$t.mock.calls
|
||||
// const expected = [['delete.comment.success']]
|
||||
// expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// it('displays a success message', () => {
|
||||
// const calls = mocks.$t.mock.calls
|
||||
// const expected = [['delete.comment.success']]
|
||||
// expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user