mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Remove dead imports; add test
This commit is contained in:
parent
8ac914eb89
commit
125fa149ad
@ -9,6 +9,10 @@ import MutationObserver from 'mutation-observer'
|
||||
|
||||
global.MutationObserver = MutationObserver
|
||||
|
||||
jest.mock('image-resize-compress', () => ({
|
||||
fromURL: jest.fn((url) => new Blob([url], { type: 'image/jpeg' })),
|
||||
}))
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const stubs = {
|
||||
@ -150,6 +154,7 @@ describe('ContributionForm.vue', () => {
|
||||
image: null,
|
||||
groupId: null,
|
||||
postType: 'Article',
|
||||
files: [],
|
||||
},
|
||||
}
|
||||
postTitleInput = wrapper.find('.ds-input')
|
||||
@ -189,6 +194,17 @@ describe('ContributionForm.vue', () => {
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('can add an image to the content', async () => {
|
||||
const content = '<img src="blob:example" alt="test image" />'
|
||||
await wrapper.vm.updateEditorContent(content)
|
||||
expect(wrapper.vm.filesToUpload).toHaveLength(1)
|
||||
await wrapper.find('form').trigger('submit')
|
||||
expectedParams.variables.content = content
|
||||
expectedParams.variables.files = [{ name: 'test image', type: 'image/jpeg', upload: {} }]
|
||||
expectedParams.variables.eventInput = undefined
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
||||
})
|
||||
|
||||
it("pushes the user to the post's page", async () => {
|
||||
wrapper.find('form').trigger('submit')
|
||||
await mocks.$apollo.mutate
|
||||
@ -277,12 +293,13 @@ describe('ContributionForm.vue', () => {
|
||||
sensitive: false,
|
||||
},
|
||||
postType: 'Article',
|
||||
files: [],
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
it('calls the UpdatePost apollo mutation', async () => {
|
||||
expectedParams.variables.content = postContent
|
||||
expectedParams.variables.content = 'auf Deutsch geschrieben'
|
||||
wrapper.vm.updateEditorContent(postContent)
|
||||
await wrapper.find('form').trigger('submit')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
||||
|
||||
@ -189,7 +189,7 @@
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { urlToBlob, fromBlob, fromURL } from 'image-resize-compress'
|
||||
import { fromURL } from 'image-resize-compress'
|
||||
import Editor from '~/components/Editor/Editor'
|
||||
import PostMutations from '~/graphql/PostMutations.js'
|
||||
import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user