mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
929bec8f31
Stop blocking AI imports/proposals on missing non-critical fields. Records the chat agent drafts now save with safe placeholders, auto-generated file numbers, and a source="ai" marker that surfaces an "Added by AI" badge so a clinician can review/edit them later. Backend: - add `source` (manual|ai) column to patients/appointments/prescriptions (migration 0014) + canonical types, services, validation schemas - relax patient/appointment validation: empty file number allowed, demographic + type/provider/initials fall back to placeholders (initials derived from name) - patients.generateFileNumber() auto-assigns an MRN when one is missing - proposeAppointment accepts a name when no file number resolves; AI commits + /api/ai/import stamp source="ai" Frontend: - `source` on Appointment/Patient/Prescription types; AI commits send source="ai" - reusable <AiBadge> shown on the Patients table/detail and prescriptions list Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
158 lines
5.0 KiB
Markdown
158 lines
5.0 KiB
Markdown
# Test Results
|
|
|
|
Display test suite results with pass/fail/skip status and error details.
|
|
|
|
The `TestResults` component displays test suite results including summary statistics, progress, individual tests, and error details.
|
|
|
|
See `scripts/test-results.tsx` for this example.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npx ai-elements@latest add test-results
|
|
```
|
|
|
|
## Features
|
|
|
|
- Summary statistics (passed/failed/skipped)
|
|
- Progress bar visualization
|
|
- Collapsible test suites
|
|
- Individual test status and duration
|
|
- Error messages with stack traces
|
|
- Color-coded status indicators
|
|
|
|
## Status Colors
|
|
|
|
| Status | Color | Use Case |
|
|
| --------- | --------------- | ---------------- |
|
|
| `passed` | Green | Test succeeded |
|
|
| `failed` | Red | Test failed |
|
|
| `skipped` | Yellow | Test skipped |
|
|
| `running` | Blue (animated) | Test in progress |
|
|
|
|
## Examples
|
|
|
|
### Basic Usage
|
|
|
|
See `scripts/test-results-basic.tsx` for this example.
|
|
|
|
### With Test Suites
|
|
|
|
See `scripts/test-results-suites.tsx` for this example.
|
|
|
|
### With Error Details
|
|
|
|
See `scripts/test-results-errors.tsx` for this example.
|
|
|
|
## Props
|
|
|
|
### `<TestResults />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `summary` | `unknown` | - | Test results summary. |
|
|
| `className` | `string` | - | Additional CSS classes. |
|
|
|
|
### `<TestSuite />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `name` | `string` | - | Suite name. |
|
|
| `status` | `unknown` | - | Overall suite status. |
|
|
| `defaultOpen` | `boolean` | - | Initially expanded. |
|
|
|
|
### `<Test />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `name` | `string` | - | Test name. |
|
|
| `status` | `unknown` | - | Test status. |
|
|
| `duration` | `number` | - | Test duration in ms. |
|
|
|
|
### `<TestResultsHeader />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestResultsSummary />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestResultsDuration />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLSpanElement>` | - | Any other props are spread to the span element. |
|
|
|
|
### `<TestResultsProgress />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestResultsContent />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestSuiteName />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.ComponentProps<typeof CollapsibleTrigger>` | - | Any other props are spread to the CollapsibleTrigger component. |
|
|
|
|
### `<TestSuiteStats />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `passed` | `number` | `0` | Number of passed tests. |
|
|
| `failed` | `number` | `0` | Number of failed tests. |
|
|
| `skipped` | `number` | `0` | Number of skipped tests. |
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestSuiteContent />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.ComponentProps<typeof CollapsibleContent>` | - | Any other props are spread to the CollapsibleContent component. |
|
|
|
|
### `<TestStatus />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLSpanElement>` | - | Any other props are spread to the span element. |
|
|
|
|
### `<TestName />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLSpanElement>` | - | Any other props are spread to the span element. |
|
|
|
|
### `<TestDuration />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLSpanElement>` | - | Any other props are spread to the span element. |
|
|
|
|
### `<TestError />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLDivElement>` | - | Any other props are spread to the div element. |
|
|
|
|
### `<TestErrorMessage />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLParagraphElement>` | - | Any other props are spread to the p element. |
|
|
|
|
### `<TestErrorStack />`
|
|
|
|
| Prop | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `...props` | `React.HTMLAttributes<HTMLPreElement>` | - | Any other props are spread to the pre element. |
|