-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Wire end-to-end pipeline — Dashboard ↔ Gateway ↔ Intelligence #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rsalus
wants to merge
7
commits into
main
Choose a base branch
from
e2e-wiring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f2496ec
feat(intelligence): add generic policy fallback for unsupported proce…
rsalus a904b80
feat(gateway): add MockDataService.ApplyAnalysisResult for intelligen…
rsalus 26b365a
test(dashboard): expand component tests for real Intelligence data sh…
rsalus 4c881f8
feat(gateway): replace IntelligenceClient stub with real HTTP impleme…
rsalus d84e6b3
Merge branch 'feature/e2e-wiring/dashboard-tests' into e2e-wiring
rsalus deadf1a
feat(gateway): wire ProcessPARequest mutation through FHIR + Intellig…
rsalus 0f70bc7
test(gateway): add ProcessPARequest integration tests with Alba
rsalus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
apps/dashboard/src/components/__tests__/PARequestCard.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| import { describe, it, expect, vi } from 'vitest'; | ||
| import { render, screen, fireEvent } from '@testing-library/react'; | ||
| import { PARequestCard, type PARequest } from '../PARequestCard'; | ||
|
|
||
| // Mock @tanstack/react-router Link component | ||
| vi.mock('@tanstack/react-router', () => ({ | ||
| Link: ({ children, to, params }: { children: React.ReactNode; to: string; params?: Record<string, string> }) => ( | ||
| <a href={`${to}/${params?.transactionId ?? ''}`} data-testid="router-link"> | ||
| {children} | ||
| </a> | ||
| ), | ||
| })); | ||
|
|
||
| function createMockPARequest(overrides: Partial<PARequest> = {}): PARequest { | ||
| return { | ||
| id: 'PA-001', | ||
| patientName: 'Jane Smith', | ||
| patientId: 'MRN-12345', | ||
| procedureCode: '72148', | ||
| procedureName: 'MRI Lumbar Spine', | ||
| payer: 'Blue Cross Blue Shield', | ||
| currentStep: 'process', | ||
| createdAt: new Date().toISOString(), | ||
| encounterId: 'ENC-001', | ||
| ...overrides, | ||
| }; | ||
| } | ||
|
|
||
| describe('PARequestCard', () => { | ||
| describe('rendering', () => { | ||
| it('PARequestCard_WithValidRequest_DisplaysPatientInfo', () => { | ||
| const request = createMockPARequest(); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('Jane Smith')).toBeInTheDocument(); | ||
| expect(screen.getByText(/MRN-12345/)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithValidRequest_DisplaysProcedure', () => { | ||
| const request = createMockPARequest(); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('72148')).toBeInTheDocument(); | ||
| expect(screen.getByText('MRI Lumbar Spine')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithValidRequest_DisplaysPayer', () => { | ||
| const request = createMockPARequest(); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('Blue Cross Blue Shield')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('confidence display', () => { | ||
| it('PARequestCard_WithHighConfidence_DisplaysPercentage', () => { | ||
| const request = createMockPARequest({ confidenceScore: 0.92 }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText(/92%/)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithMediumConfidence_DisplaysPercentage', () => { | ||
| const request = createMockPARequest({ confidenceScore: 0.65 }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText(/65%/)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithLowConfidence_DisplaysReviewBadge', () => { | ||
| const request = createMockPARequest({ confidenceScore: 0.42 }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| // Low confidence (< 0.5) shows "Review" text in a badge (data-slot="badge") | ||
| const badges = screen.getAllByText('Review'); | ||
| const confidenceBadge = badges.find(el => el.getAttribute('data-slot') === 'badge'); | ||
| expect(confidenceBadge).toBeDefined(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithUndefinedConfidence_ShowsNoConfidenceBadge', () => { | ||
| const request = createMockPARequest({ confidenceScore: undefined }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| // No confidence percentage badge should render | ||
| expect(screen.queryByText(/\d+%/)).not.toBeInTheDocument(); | ||
| // The only "Review" text should be from the WorkflowProgress step, not a badge | ||
| const reviewElements = screen.queryAllByText('Review'); | ||
| const confidenceBadge = reviewElements.find(el => el.getAttribute('data-slot') === 'badge'); | ||
| expect(confidenceBadge).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('PARequestCard_WithRealConfidenceRange_DisplaysCorrectly', () => { | ||
| // Test with various realistic confidence values from Intelligence | ||
| const request = createMockPARequest({ confidenceScore: 0.78 }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText(/78%/)).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('workflow states', () => { | ||
| it('PARequestCard_InProcessingState_ShowsProcessingIndicator', () => { | ||
| const request = createMockPARequest({ currentStep: 'process' }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('Processing...')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_InDeliverState_ShowsReviewButton', () => { | ||
| const request = createMockPARequest({ currentStep: 'deliver' }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('Review & Confirm')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('PARequestCard_InReviewCompletedState_ShowsSubmittedMessage', () => { | ||
| const request = createMockPARequest({ | ||
| currentStep: 'review', | ||
| stepStatuses: { review: 'completed' }, | ||
| }); | ||
| render(<PARequestCard request={request} />); | ||
|
|
||
| expect(screen.getByText('Submitted to athenahealth')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('attention flag', () => { | ||
| it('PARequestCard_RequiresAttention_HasWarningRing', () => { | ||
| const request = createMockPARequest({ requiresAttention: true }); | ||
| const { container } = render(<PARequestCard request={request} />); | ||
|
|
||
| const card = container.firstChild as HTMLElement; | ||
| expect(card.className).toMatch(/ring-warning/); | ||
| }); | ||
| }); | ||
|
|
||
| describe('callbacks', () => { | ||
| it('PARequestCard_OnReviewClick_CallsCallback', () => { | ||
| const onReview = vi.fn(); | ||
| const request = createMockPARequest({ currentStep: 'deliver' }); | ||
| render(<PARequestCard request={request} onReview={onReview} />); | ||
|
|
||
| fireEvent.click(screen.getByText('Review & Confirm')); | ||
|
|
||
| expect(onReview).toHaveBeenCalledWith('PA-001'); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix TypeScript tuple access error causing pipeline failure.
The pipeline reports
TS2493: Tuple type '[options: RequestOptions<object, unknown>]' of length '1' has no element at index '1'. The mock type inference doesn't recognize the second argument. Apply the same workaround used inuseDenyPARequesttest at line 74.🐛 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 GitHub Actions: CI
[error] 100-100: TS2493: Tuple type '[options: RequestOptions<object, unknown>]' of length '1' has no element at index '1'.
🤖 Prompt for AI Agents