Cleanup test directory

This commit is contained in:
wvffle 2022-09-02 21:18:42 +00:00 committed by Georg Krause
commit fb27bccaa3
4 changed files with 2 additions and 1 deletions

View file

@ -0,0 +1,50 @@
import DangerousButton from '~/components/common/DangerousButton.vue'
import AlbumDetail from '~/views/admin/library/AlbumDetail.vue'
import SanitizedHtml from '~/components/SanitizedHtml.vue'
import HumanDate from '~/components/common/HumanDate.vue'
import moxios from 'moxios'
import { shallowMount } from '@vue/test-utils'
import { gettext } from '~/init/locale'
import { sleep } from '?/utils'
import router from '~/router'
import store from '~/store'
beforeEach(() => moxios.install())
afterEach(() => moxios.uninstall())
describe('views/admin/library', () => {
describe('Album details', () => {
it('displays default cover', async () => {
const album = { cover: null, artist: { id: 1 }, title: 'dummy', id: 1, creation_date: '2020-01-01' }
moxios.stubRequest('manage/library/albums/1/', {
status: 200,
response: album
})
moxios.stubRequest('manage/library/albums/1/stats/', {
status: 200,
response: {}
})
const wrapper = shallowMount(AlbumDetail, {
props: { id: 1 },
directives: {
dropdown: () => null,
title: () => null,
lazy: () => null
},
global: {
stubs: { DangerousButton, HumanDate, SanitizedHtml },
plugins: [gettext, router, store]
}
})
await sleep()
expect(wrapper.find('img').attributes('src')).to.include('default-cover')
})
})
})

1
front/test/utils.ts Normal file
View file

@ -0,0 +1 @@
export const sleep = (ms = 0) => new Promise<void>(resolve => setTimeout(resolve, ms))