Spaces:
Paused
Paused
File size: 1,065 Bytes
6d06b8a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import { describe, it, expect, vi } from 'vitest'
import { shallowMount } from '@vue/test-utils'
import BackdropsView from '@/views/BackdropsView.vue'
import ImageListView from '@/components/ImageListView.vue'
import { adminApi } from '@/lib/api'
vi.mock('@/lib/api', () => ({
adminApi: {
getBackdrops: vi.fn(),
getBackdropImage: vi.fn(),
fetchBackdrop: vi.fn(),
},
}))
describe('BackdropsView', () => {
it('renders ImageListView with kind="backdrop"', () => {
const wrapper = shallowMount(BackdropsView)
const imageList = wrapper.findComponent(ImageListView)
expect(imageList.exists()).toBe(true)
expect(imageList.props('kind')).toBe('backdrop')
})
it('passes correct API functions as props', () => {
const wrapper = shallowMount(BackdropsView)
const imageList = wrapper.findComponent(ImageListView)
expect(imageList.props('listFn')).toBe(adminApi.getBackdrops)
expect(imageList.props('imageFn')).toBe(adminApi.getBackdropImage)
expect(imageList.props('fetchFn')).toBe(adminApi.fetchBackdrop)
})
})
|