Skip to content

ref(ui): Remove usage of withOrganization from organizationAuthList #86554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@ import {OrganizationAuthList} from 'sentry/views/settings/organizationAuth/organ

describe('OrganizationAuthList', function () {
it('renders with no providers', function () {
render(
<OrganizationAuthList organization={OrganizationFixture()} providerList={[]} />
);
render(<OrganizationAuthList providerList={[]} />);

expect(
screen.getByText('No authentication providers are available.')
).toBeInTheDocument();
});

it('renders', function () {
render(
<OrganizationAuthList
organization={OrganizationFixture()}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />);

expect(screen.getAllByLabelText('Configure')).toHaveLength(2);
expect(screen.getByText('Dummy')).toBeInTheDocument();
Expand All @@ -34,10 +27,10 @@ describe('OrganizationAuthList', function () {

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
activeProvider={AuthProvidersFixture()[0]}
/>
/>,
{organization}
);

expect(screen.getByText('Active')).toBeInTheDocument();
Expand All @@ -51,12 +44,9 @@ describe('OrganizationAuthList', function () {
it('renders', function () {
const organization = OrganizationFixture({...require2fa, ...withSSO});

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
organization,
});

expect(
screen.getByText('Require 2FA will be disabled if you enable SSO.')
Expand All @@ -66,12 +56,9 @@ describe('OrganizationAuthList', function () {
it('renders with saml available', function () {
const organization = OrganizationFixture({...require2fa, ...withSAML});

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
organization,
});

expect(
screen.getByText('Require 2FA will be disabled if you enable SSO.')
Expand All @@ -81,12 +68,9 @@ describe('OrganizationAuthList', function () {
it('does not render without sso available', function () {
const organization = OrganizationFixture({...require2fa});

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
organization,
});

expect(
screen.queryByText('Require 2FA will be disabled if you enable SSO.')
Expand All @@ -96,12 +80,9 @@ describe('OrganizationAuthList', function () {
it('does not render with sso and require 2fa disabled', function () {
const organization = OrganizationFixture({...withSSO});

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
organization,
});

expect(
screen.queryByText('Require 2FA will be disabled if you enable SSO.')
Expand All @@ -111,12 +92,9 @@ describe('OrganizationAuthList', function () {
it('does not render with saml and require 2fa disabled', function () {
const organization = OrganizationFixture({...withSAML});

render(
<OrganizationAuthList
organization={organization}
providerList={AuthProvidersFixture()}
/>
);
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
organization,
});

expect(
screen.queryByText('Require 2FA will be disabled if you enable SSO.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import PanelBody from 'sentry/components/panels/panelBody';
import PanelHeader from 'sentry/components/panels/panelHeader';
import {t, tct} from 'sentry/locale';
import type {AuthProvider} from 'sentry/types/auth';
import type {Organization} from 'sentry/types/organization';
import {descopeFeatureName} from 'sentry/utils';
import getCsrfToken from 'sentry/utils/getCsrfToken';
import withOrganization from 'sentry/utils/withOrganization';
import useOrganization from 'sentry/utils/useOrganization';
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
import {OrganizationPermissionAlert} from 'sentry/views/settings/organization/organizationPermissionAlert';

Expand All @@ -28,12 +27,12 @@ const PROVIDER_POPULARITY: Record<string, number> = {
};

type Props = {
organization: Organization;
providerList: AuthProvider[];
activeProvider?: AuthProvider;
};

function OrganizationAuthList({organization, providerList, activeProvider}: Props) {
function OrganizationAuthList({providerList, activeProvider}: Props) {
const organization = useOrganization();
const features = organization.features;

// Sort provider list twice: first, by popularity,
Expand Down Expand Up @@ -118,7 +117,7 @@ function OrganizationAuthList({organization, providerList, activeProvider}: Prop
);
}

export default withOrganization(OrganizationAuthList);
export default OrganizationAuthList;

// For tests
export {OrganizationAuthList};
Loading