mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem The OAuth apps consent screen does not allow users to change the selected org. If the calling app didn't provide the org slug, we select the first available org from the users orgs. ## Solution Add an organization selector: <img width="436" height="570" alt="image" src="https://github.com/user-attachments/assets/a5579f2c-ff54-4d02-9d4a-ac75ed245719" /> ## Review instructions Requirements: - have multiple orgs - have a published app that needs projects selection and at least one authorization already granted - have the oauth example app ready Tests: - authorizing the app again on the same org it was before should preselect the projects - you should be able to select another org and if you do, that should clear the selected projects and you should see only this org projects in the options - reselecting the initially granted org should reselect the projects it had in the existing grant
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { screen } from '@testing-library/react'
|
|
import { describe, expect, test } from 'vitest'
|
|
|
|
import { NoProjectsNotice } from './NoProjectsNotice'
|
|
import { customRender } from '@/tests/lib/custom-render'
|
|
|
|
describe('NoProjectsNotice', () => {
|
|
test('interpolates the organization into the title', () => {
|
|
customRender(<NoProjectsNotice appName="Vercel" organizationName="contoso-labs" />)
|
|
|
|
expect(screen.getByText('No projects in contoso-labs')).toBeInTheDocument()
|
|
})
|
|
|
|
test('interpolates the app name into the body', () => {
|
|
customRender(<NoProjectsNotice appName="Vercel" organizationName="contoso-labs" />)
|
|
|
|
expect(
|
|
screen.getByText(
|
|
"Vercel needs access to at least one project, and this organization doesn't have any yet."
|
|
)
|
|
).toBeInTheDocument()
|
|
})
|
|
|
|
test('interpolates a different app name, so the copy is not hardcoded', () => {
|
|
customRender(<NoProjectsNotice appName="Fabrikam" organizationName="contoso-labs" />)
|
|
|
|
expect(
|
|
screen.getByText(
|
|
"Fabrikam needs access to at least one project, and this organization doesn't have any yet."
|
|
)
|
|
).toBeInTheDocument()
|
|
})
|
|
|
|
test('shows the same organization slug it was given', () => {
|
|
customRender(<NoProjectsNotice appName="Vercel" organizationName="northwind-traders" />)
|
|
|
|
expect(screen.getByText('No projects in northwind-traders')).toBeInTheDocument()
|
|
expect(screen.queryByText('No projects in contoso-labs')).not.toBeInTheDocument()
|
|
})
|
|
})
|