Fix broken tests, revert changes to error watch property

- causing breaking change in the tests
This commit is contained in:
Matt Rider 2019-06-03 19:14:29 -03:00
parent 31a6d36e59
commit 5c6147ee47
2 changed files with 4 additions and 28 deletions

View File

@ -12,7 +12,7 @@
<hc-avatar :user="user" class="profile-avatar" size="x-large"></hc-avatar>
<div class="hc-attachments-upload-area">
<div class="hc-drag-marker">
<ds-icon v-if="hover" name="image" size="xxx-large"/>
<ds-icon v-if="hover" name="image" size="xxx-large" />
</div>
</div>
</div>
@ -46,9 +46,10 @@ export default {
}
},
watch: {
error: () => {
error() {
let that = this
setTimeout(function() {
this.error = false
that.error = false
}, 2000)
},
},

View File

@ -35,26 +35,6 @@ describe('Upload', () => {
},
}
const fileSuccess = {
filename: 'avatar.jpg',
previewElement: {
classList: {
remove: jest.fn(),
add: jest.fn(),
},
querySelectorAll: jest.fn().mockReturnValue([
{
alt: '',
style: {
'background-image': '/api/generic.jpg',
},
},
]),
},
}
const dataUrl = 'avatar.jpg'
beforeEach(() => {
jest.useFakeTimers()
wrapper = shallowMount(Upload, { localVue, propsData, mocks })
@ -69,11 +49,6 @@ describe('Upload', () => {
expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1)
})
it('thumbnail', () => {
wrapper.vm.thumbnail(fileSuccess, dataUrl)
expect(fileSuccess.previewElement.classList.add).toHaveBeenCalledTimes(1)
})
describe('error handling', () => {
const message = 'File upload failed'
const fileError = { status: 'error' }