Files
supabase/apps/studio/components/ui/AIAssistantPanel/SupportRequestMessage.test.tsx
Saxon Fletcher 033daf223c Support form Assistant Streamdown (#46248)
Re-adds support form Assistant response using a lighter weight
Streamdown component vs the more heavy `Message` component.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* AI Assistant follow-up card after ticket submission for project-scoped
requests.
* In-chat support request preview panels showing submitted subject and
message.

* **Improvements**
* Smarter project selection when opening the support form via
route/context.
* Success screen: cleaner layout, project-name messaging, optional
finish action, and a "Join Discord" button.
  * Category prompt text updated to "What issue are you having?"
  * New success/feedback section for consistent layouts.

* **Tests**
* Added tests covering support prompt serialization/parsing and UI
previews.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46248?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-26 09:56:52 +00:00

49 lines
1.8 KiB
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
import { parseSupportRequestMessage, SupportRequestMessage } from './SupportRequestMessage'
describe('SupportRequestMessage', () => {
it('parses support-tagged messages', () => {
expect(
parseSupportRequestMessage(`
<support>
<subject>Database unavailable</subject>
<message>Connections are timing out</message>
</support>
`)
).toMatchObject({
subject: 'Database unavailable',
message: 'Connections are timing out',
})
})
it('renders a structured support request summary', () => {
render(
<SupportRequestMessage
request={{
assistant_context:
'A support request has already been submitted and a human member of the Supabase Support team is already looking at it.',
subject: 'Database unavailable',
message: 'Connections are timing out',
organization_slug: 'org-1',
project_ref: 'project-1',
category: 'Problem',
severity: 'High',
support_access: 'Granted',
library: 'Not provided',
}}
/>
)
expect(screen.getByText('Support request submitted')).toBeInTheDocument()
expect(screen.getByText('Database unavailable')).toBeInTheDocument()
expect(screen.getByText('Connections are timing out')).toBeInTheDocument()
expect(screen.queryByText('org-1')).not.toBeInTheDocument()
expect(screen.queryByText('project-1')).not.toBeInTheDocument()
expect(screen.queryByText('Granted')).not.toBeInTheDocument()
expect(screen.queryByText('Client library')).not.toBeInTheDocument()
expect(screen.queryByText(/human member of the supabase support team/i)).not.toBeInTheDocument()
})
})