このコミットが含まれているのは:
@@ -71,11 +71,25 @@ describe ('PostImportReviewPage', () => {
|
||||
|
||||
renderReviewPage ()
|
||||
|
||||
expect (screen.getByRole ('heading', { name: '広場に投稿を追加' })).toBeInTheDocument ()
|
||||
expect (screen.getByRole ('heading', { name: '追加内容確認' })).toBeInTheDocument ()
|
||||
expect (screen.queryByText ('広場に投稿を追加')).not.toBeInTheDocument ()
|
||||
expect (screen.queryByText ('投稿インポート')).not.toBeInTheDocument ()
|
||||
expect (await screen.findByText ('restored row')).toBeInTheDocument ()
|
||||
})
|
||||
|
||||
it ('does not expose メタデータ to the user', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
repairMode: 'all',
|
||||
rows: [buildPostImportRow ({
|
||||
sourceRow: 1,
|
||||
fieldWarnings: { title: ['自動取得に失敗しました.'] } })] })
|
||||
|
||||
renderReviewPage ()
|
||||
|
||||
expect (screen.queryByText (/メタデータ/)).not.toBeInTheDocument ()
|
||||
})
|
||||
|
||||
it ('returns to /posts/new while keeping the current work', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
@@ -309,6 +323,69 @@ describe ('PostImportReviewPage', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it ('allows ready rows to be manually skipped and excludes them from API payloads', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
repairMode: 'all',
|
||||
rows: [buildPostImportRow ({ sourceRow: 1 })] })
|
||||
|
||||
renderReviewPage ()
|
||||
|
||||
fireEvent.click (screen.getByRole ('checkbox', { name: 'スキップ' }))
|
||||
|
||||
await waitFor (() => {
|
||||
expect (screen.getByText ('POSTS ROUTE')).toBeInTheDocument ()
|
||||
})
|
||||
expect (api.apiPost).not.toHaveBeenCalled ()
|
||||
})
|
||||
|
||||
it ('restores values and errors when manual skip is cleared', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
repairMode: 'all',
|
||||
rows: [buildPostImportRow ({
|
||||
sourceRow: 1,
|
||||
status: 'error',
|
||||
attributes: { title: 'kept title' },
|
||||
validationErrors: { title: ['invalid'] } })] })
|
||||
|
||||
renderReviewPage ()
|
||||
|
||||
const toggle = await screen.findByRole ('checkbox', { name: 'スキップ' })
|
||||
fireEvent.click (toggle)
|
||||
fireEvent.click (screen.getByRole ('checkbox', { name: 'スキップ' }))
|
||||
|
||||
expect (screen.getByText ('kept title')).toBeInTheDocument ()
|
||||
expect (screen.getByText ('invalid')).toBeInTheDocument ()
|
||||
})
|
||||
|
||||
it ('moves existing skipped rows into the collapsed section', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
repairMode: 'all',
|
||||
rows: [
|
||||
buildPostImportRow ({
|
||||
sourceRow: 1,
|
||||
attributes: { title: 'existing row' },
|
||||
skipReason: 'existing',
|
||||
existingPostId: 2 }),
|
||||
buildPostImportRow ({
|
||||
sourceRow: 2,
|
||||
attributes: { title: 'normal row' } })] })
|
||||
|
||||
renderReviewPage ()
|
||||
|
||||
expect (screen.getByText ('既存投稿による自動スキップ 1件')).toBeInTheDocument ()
|
||||
expect (screen.queryByText ('existing row')).not.toBeInTheDocument ()
|
||||
expect (screen.getByText ('normal row')).toBeInTheDocument ()
|
||||
|
||||
fireEvent.click (screen.getByRole ('button', { name: '既存投稿による自動スキップ 1件' }))
|
||||
|
||||
expect (screen.getByText ('existing row')).toBeInTheDocument ()
|
||||
expect (screen.queryAllByRole ('button', { name: '編輯' })).toHaveLength (1)
|
||||
expect (screen.queryAllByRole ('checkbox', { name: 'スキップ' })).toHaveLength (1)
|
||||
})
|
||||
|
||||
it ('navigates to /posts when the last failed row completes', async () => {
|
||||
savePostImportSession ({
|
||||
source: 'https://example.com/post',
|
||||
|
||||
新しい課題から参照
ユーザをブロックする