Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/aiRuns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface AiRunResponse {
status: AiRunStatus
analysis_outcome: AiAnalysisOutcome | null
detected_intent: string | null
evidence: string | null
error_code: string | null
attempt_count: number
version: number
Expand Down
1 change: 1 addition & 0 deletions src/pages/CreateWorkPage/CreateWorkPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AI_RUN = {
status: 'SUCCEEDED',
analysis_outcome: 'NEEDS_INFO',
detected_intent: 'EXPIRY_RENEWAL',
evidence: null,
error_code: null,
attempt_count: 1,
version: 1,
Expand Down
38 changes: 38 additions & 0 deletions src/pages/ReviewWorkPage/AiRunReview.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const RUN: AiRunResponse = {
status: 'SUCCEEDED',
analysis_outcome: 'REVIEW_REQUIRED',
detected_intent: 'EXPIRY_RENEWAL',
evidence: null,
error_code: null,
attempt_count: 1,
version: 3,
Expand Down Expand Up @@ -92,6 +93,7 @@ function processingRun(): AiRunResponse {
status: 'RUNNING',
analysis_outcome: null,
detected_intent: null,
evidence: null,
version: 1,
questions: [],
candidates: [],
Expand All @@ -104,6 +106,7 @@ function needsInfoRun(): AiRunResponse {
status: 'SUCCEEDED',
analysis_outcome: 'NEEDS_INFO',
detected_intent: 'EXPIRY_RENEWAL',
evidence: null,
version: 2,
questions: [
{
Expand Down Expand Up @@ -234,6 +237,41 @@ describe('AiRunReview candidate decision', () => {
})
})

describe('AiRunReview 분석 근거', () => {
function mockCatalogAndWorkers() {
vi.mocked(fetch).mockImplementation((input) => {
const url = String(input)
if (url.includes('/workflow-catalogs')) return Promise.resolve(jsonResponse(CATALOG))
if (url.includes('/workers')) {
return Promise.resolve(jsonResponse({ items: [], page: 0, size: 100, total_elements: 0 }))
}
return Promise.reject(new Error(`Unexpected request: ${url}`))
})
}

it('renders the evidence text returned by the API', async () => {
mockCatalogAndWorkers()
render(
<MemoryRouter>
<AiRunReview initialRun={{ ...RUN, evidence: '체류만료일이 30일 이내로 확인됨' }} />
</MemoryRouter>,
)

expect(await screen.findByText('체류만료일이 30일 이내로 확인됨')).toBeInTheDocument()
})

it('falls back to a placeholder when the API has no evidence yet', async () => {
mockCatalogAndWorkers()
render(
<MemoryRouter>
<AiRunReview initialRun={{ ...RUN, evidence: null }} />
</MemoryRouter>,
)

expect(await screen.findByText('현재 분석 API에서 제공하지 않음')).toBeInTheDocument()
})
})

describe('AiRunReview progress updates', () => {
afterEach(() => {
vi.useRealTimers()
Expand Down
4 changes: 3 additions & 1 deletion src/pages/ReviewWorkPage/AiRunReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ export function AiRunReview({ initialRun, initialDraft }: AiRunReviewProps) {
</div>
<div>
<p className={styles.fieldLabel}>분석 근거</p>
<p className={styles.fieldValue}>현재 분석 API에서 제공하지 않음</p>
<p className={styles.fieldValue}>
{run.evidence ?? '현재 분석 API에서 제공하지 않음'}
</p>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReviewWorkPage/ReviewWorkPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('ReviewWorkPage', () => {
status: 'SUCCEEDED',
analysis_outcome: 'NEEDS_INFO',
detected_intent: 'EXPIRY_RENEWAL',
evidence: null,
error_code: null,
attempt_count: 1,
version: 1,
Expand Down