mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
27 lines
841 B
TypeScript
27 lines
841 B
TypeScript
import { faker } from '@faker-js/faker'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { h } from 'vue'
|
|
import { page, render } from '~/test'
|
|
import DashboardEntry from './DashboardEntry.vue'
|
|
|
|
const bodyTestId = 'body-content'
|
|
const headerTestId = 'header-content'
|
|
|
|
function div(o: { testId: string; body: string }) {
|
|
return h('div', { 'data-testid': o.testId }, o.body)
|
|
}
|
|
|
|
describe('DashboardEntry', () => {
|
|
it('renders the body and header slots', async () => {
|
|
render(DashboardEntry, {
|
|
slots: {
|
|
body: div({ testId: bodyTestId, body: faker.lorem.words(2) }),
|
|
header: div({ testId: headerTestId, body: faker.hacker.phrase() }),
|
|
},
|
|
})
|
|
|
|
await expect.element(page.getByTestId(bodyTestId)).toBeInTheDocument()
|
|
await expect.element(page.getByTestId(headerTestId)).toBeInTheDocument()
|
|
})
|
|
})
|