41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest'
|
|
import { render, screen } from '@testing-library/react'
|
|
import { CapaOwnerActions } from '@/components/capa/capa-owner-actions'
|
|
|
|
// Mock Next.js router
|
|
vi.mock('next/navigation', () => ({
|
|
useRouter: () => ({ refresh: vi.fn() }),
|
|
}))
|
|
|
|
describe('CapaOwnerActions', () => {
|
|
it('shows Mark In Progress for open status', () => {
|
|
render(<CapaOwnerActions capaId="abc" currentStatus="open" />)
|
|
expect(screen.getByText('Mark In Progress')).toBeTruthy()
|
|
})
|
|
|
|
it('shows Mark In Progress for reopened status', () => {
|
|
render(<CapaOwnerActions capaId="abc" currentStatus="reopened" />)
|
|
expect(screen.getByText('Mark In Progress')).toBeTruthy()
|
|
})
|
|
|
|
it('shows Mark In Progress for overdue status', () => {
|
|
render(<CapaOwnerActions capaId="abc" currentStatus="overdue" />)
|
|
expect(screen.getByText('Mark In Progress')).toBeTruthy()
|
|
})
|
|
|
|
it('shows Submit for Verification for in_progress status', () => {
|
|
render(<CapaOwnerActions capaId="abc" currentStatus="in_progress" />)
|
|
expect(screen.getByText('Submit for Verification')).toBeTruthy()
|
|
})
|
|
|
|
it('renders nothing for pending_verification status', () => {
|
|
const { container } = render(<CapaOwnerActions capaId="abc" currentStatus="pending_verification" />)
|
|
expect(container.firstChild).toBeNull()
|
|
})
|
|
|
|
it('renders nothing for verified status', () => {
|
|
const { container } = render(<CapaOwnerActions capaId="abc" currentStatus="verified" />)
|
|
expect(container.firstChild).toBeNull()
|
|
})
|
|
})
|