This commit is contained in:
Marcus Eide
2020-10-06 15:19:56 +02:00
parent 28f2d1e030
commit b47299806e
4 changed files with 20 additions and 23 deletions
@@ -24,7 +24,7 @@ import {
import { renderWithEffects, wrapInTestApp } from '@backstage/test-utils';
import { fireEvent } from '@testing-library/react';
import React from 'react';
import { DefaultProviderSettings } from './DefaultProviderSettings';
import { AuthProviders } from './AuthProviders';
const mockSignInHandler = jest.fn().mockReturnValue('');
const mockGoogleAuth = {
@@ -57,12 +57,12 @@ const apiRegistry = ApiRegistry.from([
[googleAuthApiRef, mockGoogleAuth],
]);
describe('<ConfiguredProviderSettings />', () => {
describe('<AuthProviders />', () => {
it('displays a provider and calls its sign-in handler on click', async () => {
const rendered = await renderWithEffects(
wrapInTestApp(
<ApiProvider apis={apiRegistry}>
<DefaultProviderSettings />
<AuthProviders />
</ApiProvider>,
),
);
@@ -18,38 +18,38 @@ import React from 'react';
import { CodeSnippet, EmptyState } from '@backstage/core';
import { Button, Typography } from '@material-ui/core';
const EXAMPLE = `
import { createPlugin } from '@backstage/core';
export default createPlugin({
id: 'welcome',
register({ router, featureFlags }) {
featureFlags.register('enable-example-feature');
},
});
const EXAMPLE = `auth:
providers:
google:
development:
clientId:
$env: AUTH_GOOGLE_CLIENT_ID
clientSecret:
$env: AUTH_GOOGLE_CLIENT_SECRET
`;
export const EmptyProviders = () => (
<EmptyState
missing="content"
title="No Authentication Providers"
description=""
description="You can add Authentication Providers to Backstage which allows you to use these providers to authenticate yourself."
action={
<>
<Typography variant="body1">
An example how how to add a feature flags is highlighted below:
Open <code>app-config.yaml</code> and make the changes as highlighted
below:
</Typography>
<CodeSnippet
text={EXAMPLE}
language="typescript"
language="yaml"
showLineNumbers
highlightedNumbers={[7]}
highlightedNumbers={[3, 4, 5, 6, 7, 8]}
customStyle={{ background: 'inherit', fontSize: '115%' }}
/>
<Button
variant="contained"
color="primary"
href="https://backstage.io/docs/api/utility-apis"
href="https://backstage.io/docs/auth/add-auth-provider"
>
Read More
</Button>
@@ -18,8 +18,7 @@ import React from 'react';
import { CodeSnippet, EmptyState } from '@backstage/core';
import { Button, Typography } from '@material-ui/core';
const EXAMPLE = `
import { createPlugin } from '@backstage/core';
const EXAMPLE = `import { createPlugin } from '@backstage/core';
export default createPlugin({
id: 'welcome',
@@ -43,7 +42,7 @@ export const EmptyFlags = () => (
text={EXAMPLE}
language="typescript"
showLineNumbers
highlightedNumbers={[7]}
highlightedNumbers={[6]}
customStyle={{ background: 'inherit', fontSize: '115%' }}
/>
<Button
@@ -56,9 +56,7 @@ const createConfig = () =>
context: '',
data: {
auth: {
providers: {
// google: { development: {} },
},
providers: {},
},
},
},