test: migrate 13 component tests from VTU to VTL (Phase 1) (#10471)

## Summary

Migrate 13 component test files from @vue/test-utils to
@testing-library/vue as Phase 1 of incremental VTL adoption.

## Changes

- **What**: Rewrite 13 test files (88 tests) to use `render`/`screen`
queries, `userEvent` interactions, and `jest-dom` assertions. Add
`data-testid` attributes to 6 components for lint-clean icon/element
queries. Delete unused `src/utils/test-utils.ts`.
- **Dependencies**: `@testing-library/vue`,
`@testing-library/user-event`, `@testing-library/jest-dom` (installed in
Phase 0)

## Review Focus

- `data-testid` additions to component templates are minimal and
non-behavioral
- PrimeVue passthrough (`pt`) usage in UserAvatar.vue for icon testid
- 2 targeted `eslint-disable` in FormRadioGroup.test.ts where PrimeVue
places `aria-describedby` on wrapper div, not input

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10471-test-migrate-13-component-tests-from-VTU-to-VTL-Phase-1-32d6d73d36508159a33ffa285afb4c38)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-03-26 18:15:11 -07:00
committed by GitHub
parent 98a9facc7d
commit 08b1199265
23 changed files with 476 additions and 584 deletions

View File

@@ -1,4 +1,4 @@
import { mount } from '@vue/test-utils'
import { render, screen } from '@testing-library/vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { nextTick, ref } from 'vue'
import type { Ref } from 'vue'
@@ -17,8 +17,9 @@ vi.mock('@/composables/queue/useQueueProgress', () => ({
})
}))
const createWrapper = (props: { hidden?: boolean } = {}) =>
mount(QueueInlineProgress, { props })
function renderComponent(props: { hidden?: boolean } = {}) {
return render(QueueInlineProgress, { props })
}
describe('QueueInlineProgress', () => {
beforeEach(() => {
@@ -29,47 +30,53 @@ describe('QueueInlineProgress', () => {
it('renders when total progress is non-zero', () => {
mockProgress.totalPercent.value = 12
const wrapper = createWrapper()
renderComponent()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(true)
expect(screen.getByTestId('queue-inline-progress')).toBeInTheDocument()
})
it('renders when current node progress is non-zero', () => {
mockProgress.currentNodePercent.value = 33
const wrapper = createWrapper()
renderComponent()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(true)
expect(screen.getByTestId('queue-inline-progress')).toBeInTheDocument()
})
it('does not render when hidden', () => {
mockProgress.totalPercent.value = 45
const wrapper = createWrapper({ hidden: true })
renderComponent({ hidden: true })
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(false)
expect(
screen.queryByTestId('queue-inline-progress')
).not.toBeInTheDocument()
})
it('shows when progress becomes non-zero', async () => {
const wrapper = createWrapper()
renderComponent()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(false)
expect(
screen.queryByTestId('queue-inline-progress')
).not.toBeInTheDocument()
mockProgress.totalPercent.value = 10
await nextTick()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(true)
expect(screen.getByTestId('queue-inline-progress')).toBeInTheDocument()
})
it('hides when progress returns to zero', async () => {
mockProgress.totalPercent.value = 10
const wrapper = createWrapper()
renderComponent()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(true)
expect(screen.getByTestId('queue-inline-progress')).toBeInTheDocument()
mockProgress.totalPercent.value = 0
mockProgress.currentNodePercent.value = 0
await nextTick()
expect(wrapper.find('[aria-hidden="true"]').exists()).toBe(false)
expect(
screen.queryByTestId('queue-inline-progress')
).not.toBeInTheDocument()
})
})