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
7 changes: 5 additions & 2 deletions apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ describe('OAuth consent view', () => {
vi.useRealTimers()
})

it('shows the registered app, account and destination with one row per distinct capability', () => {
it('shows the account below the decisions without a CLI destination sentence', () => {
expect(container.querySelector('h1')?.textContent).toBe('Authorize Sim CLI')
expect(container.textContent).toContain('Continuing as test@example.com.')
expect(container.textContent).toContain('Returns to this computer.')
expect(container.textContent).not.toContain('Returns to this computer.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-CLI Path Lacks Coverage

The new assertion covers only the CLI suppression path because the fixture always uses clientId='sim-cli'. The new non-CLI branch has no positive test confirming that Returns to {destination} remains visible, so a future regression in that requirement could pass unnoticed. Add a non-CLI case with a valid redirect URI and assert that its destination is shown.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

expect(
Array.from(container.querySelectorAll('button')).map((element) => element.textContent)
).toEqual(['Allow', 'Deny', 'Use another account'])
expect(container.querySelectorAll('li')).toHaveLength(2)
expect(button('Allow').disabled).toBe(false)
expect(button('Deny').disabled).toBe(false)
Expand Down
14 changes: 7 additions & 7 deletions apps/sim/app/(auth)/oauth/consent/consent-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ export function OAuthConsentView({
))}
</ul>
)}
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
Continuing as {email}.{' '}
<AuthTextLink onClick={changeAccount} disabled={isPending}>
{switchAccount.isPending ? 'Signing out…' : 'Use another account'}
</AuthTextLink>
</p>
<AuthSubmitButton
type='button'
loading={consent.isPending && consent.variables === true}
Expand All @@ -177,7 +171,7 @@ export function OAuthConsentView({
>
{consent.isPending && consent.variables === false ? 'Declining…' : 'Deny'}
</Chip>
{destination && (
{!isCli && destination && (
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
Returns to {destination}.
</p>
Expand All @@ -192,6 +186,12 @@ export function OAuthConsentView({
</AuthFormMessage>
</div>
)}
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
Continuing as {email}.{' '}
<AuthTextLink onClick={changeAccount} disabled={isPending}>
{switchAccount.isPending ? 'Signing out…' : 'Use another account'}
</AuthTextLink>
</p>
</div>
</div>
)
Expand Down
Loading