mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-02-06 09:56:03 +00:00
Update test, use destructuring to clean up code
This commit is contained in:
parent
be70088dd7
commit
51153ca870
@ -89,10 +89,16 @@ describe('ContributionForm.vue', () => {
|
||||
})
|
||||
|
||||
describe('valid form submission', () => {
|
||||
expectedParams = {
|
||||
variables: { title: postTitle, content: postContent, language: 'en', id: null },
|
||||
}
|
||||
beforeEach(async () => {
|
||||
expectedParams = {
|
||||
variables: {
|
||||
title: postTitle,
|
||||
content: postContent,
|
||||
language: 'en',
|
||||
id: null,
|
||||
imageUpload: null,
|
||||
},
|
||||
}
|
||||
postTitleInput = wrapper.find('.ds-input')
|
||||
postTitleInput.setValue('this is a title for a post')
|
||||
wrapper.vm.updateEditorContent('this is a post')
|
||||
|
||||
@ -88,7 +88,7 @@ export default {
|
||||
form: {
|
||||
title: '',
|
||||
content: '',
|
||||
teaserImage: '',
|
||||
teaserImage: null,
|
||||
language: null,
|
||||
languageOptions: [],
|
||||
},
|
||||
@ -123,6 +123,7 @@ export default {
|
||||
this.form.content = contribution.content
|
||||
this.form.title = contribution.title
|
||||
this.form.language = this.locale
|
||||
this.form.teaserImage = contribution.imageUpload
|
||||
},
|
||||
},
|
||||
error() {
|
||||
@ -146,16 +147,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
const { title, content, language, teaserImage } = this.form
|
||||
this.loading = true
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: this.id ? PostMutations().UpdatePost : PostMutations().CreatePost,
|
||||
variables: {
|
||||
id: this.id,
|
||||
title: this.form.title,
|
||||
content: this.form.content,
|
||||
language: this.form.language ? this.form.language.value : this.$i18n.locale(),
|
||||
imageUpload: this.form.teaserImage,
|
||||
title,
|
||||
content,
|
||||
language: language ? language.value : this.$i18n.locale(),
|
||||
imageUpload: teaserImage,
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user