Reviewed-on: http://git.miteruzo.com/miteruzo/btrc-hub/pulls/413 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
32 行
1006 B
TypeScript
32 行
1006 B
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
import { buildPostImportRow } from '@/test/postImportFactories'
|
|
|
|
import type { DialogueFormControls } from '@/lib/dialogues/useDialogue'
|
|
|
|
const sharedFieldsSpy = vi.hoisted (() => vi.fn (() => <div data-testid="shared-fields"/>))
|
|
|
|
vi.mock ('@/components/posts/PostCreationDataFields', () => ({
|
|
default: sharedFieldsSpy,
|
|
}))
|
|
|
|
describe ('PostCreationDataFields usage', () => {
|
|
it ('is used by PostImportRowForm', async () => {
|
|
const { default: PostImportRowForm } = await import (
|
|
'@/components/posts/import/PostImportRowForm')
|
|
|
|
render (
|
|
<PostImportRowForm
|
|
row={buildPostImportRow ()}
|
|
controls={{
|
|
close: vi.fn (),
|
|
confirm: vi.fn (),
|
|
setActions: vi.fn (),
|
|
} as DialogueFormControls}
|
|
onSave={vi.fn ()}/>)
|
|
|
|
expect (screen.getByTestId ('shared-fields')).toBeInTheDocument ()
|
|
})
|
|
})
|