feat: self-serve signup Phase 2 (frontend cutover) (#162)
Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
This commit was merged in pull request #162.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { UpgradePrompt } from '../UpgradePrompt'
|
||||
|
||||
function renderWithRouter(ui: React.ReactElement) {
|
||||
return render(<BrowserRouter>{ui}</BrowserRouter>)
|
||||
}
|
||||
|
||||
describe('UpgradePrompt', () => {
|
||||
it('renders display name and required plan from catalog', () => {
|
||||
renderWithRouter(<UpgradePrompt feature="psa_integration" />)
|
||||
expect(
|
||||
screen.getByText(/PSA Integration is available on Pro/i),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('CTA navigates to /account/billing/select-plan', () => {
|
||||
renderWithRouter(<UpgradePrompt feature="psa_integration" />)
|
||||
const cta = screen.getByRole('link', { name: /Upgrade to Pro/i })
|
||||
expect(cta).toHaveAttribute('href', '/account/billing/select-plan')
|
||||
})
|
||||
|
||||
it('humanizes unknown feature keys and falls back to Pro', () => {
|
||||
renderWithRouter(<UpgradePrompt feature="some_new_feature" />)
|
||||
expect(
|
||||
screen.getByText(/Some New Feature is available on Pro/i),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user