Spaces:
Paused
Paused
Download web/src/__tests__/views/BackdropsView.spec.ts from stremio-db/a: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/stremio-db/a/resolve/main/web/src/__tests__/views/BackdropsView.spec.ts
- Command line
-
hf download hf://spaces/stremio-db/a/web/src/__tests__/views/BackdropsView.spec.ts
-
curl -L -o BackdropsView.spec.ts https://huggingface.co/spaces/stremio-db/a/resolve/main/web/src/__tests__/views/BackdropsView.spec.ts
1.07 kB
| 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) | |
| }) | |
| }) | |