mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 23:20:04 +00:00
## Summary Enforced test file naming conventions with ESLint rules and renamed 26 test files from `.spec.ts` to `.test.ts`. ## Changes - **What**: Added ESLint rules to enforce `.spec.ts` files only in `browser_tests/tests/` and `.test.ts` files only in `src/` - **What**: Renamed 26 component/unit test files from `.spec.ts` to `.test.ts` to comply with new convention ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5820-enforce-test-file-naming-rule-27b6d73d365081269b32ddcc9d3a5048) by [Unito](https://www.unito.io)
36 lines
1004 B
TypeScript
36 lines
1004 B
TypeScript
import { mount } from '@vue/test-utils'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
import AudioThumbnail from '@/components/templates/thumbnails/AudioThumbnail.vue'
|
|
|
|
vi.mock('@/components/templates/thumbnails/BaseThumbnail.vue', () => ({
|
|
default: {
|
|
name: 'BaseThumbnail',
|
|
template: '<div class="base-thumbnail"><slot /></div>'
|
|
}
|
|
}))
|
|
|
|
describe('AudioThumbnail', () => {
|
|
const mountThumbnail = (props = {}) => {
|
|
return mount(AudioThumbnail, {
|
|
props: {
|
|
src: '/test-audio.mp3',
|
|
...props
|
|
}
|
|
})
|
|
}
|
|
|
|
it('renders an audio element with correct src', () => {
|
|
const wrapper = mountThumbnail()
|
|
const audio = wrapper.find('audio')
|
|
expect(audio.exists()).toBe(true)
|
|
expect(audio.attributes('src')).toBe('/test-audio.mp3')
|
|
})
|
|
|
|
it('uses BaseThumbnail as container', () => {
|
|
const wrapper = mountThumbnail()
|
|
const baseThumbnail = wrapper.findComponent({ name: 'BaseThumbnail' })
|
|
expect(baseThumbnail.exists()).toBe(true)
|
|
})
|
|
})
|