remove usages of some backend-common helpers
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -22,10 +22,11 @@ import PromiseRouter from 'express-promise-router';
|
||||
import { AuthProviderRouteHandlers, AuthResolverContext } from '../types';
|
||||
import { createOAuthRouteHandlers } from './createOAuthRouteHandlers';
|
||||
import { OAuthAuthenticator } from './types';
|
||||
import { errorHandler } from '@backstage/backend-common';
|
||||
import { encodeOAuthState, OAuthState } from './state';
|
||||
import { PassportProfile } from '../passport';
|
||||
import { parseWebMessageResponse } from '../flow/__testUtils__/parseWebMessageResponse';
|
||||
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
|
||||
const mockAuthenticator: jest.Mocked<OAuthAuthenticator<unknown, unknown>> = {
|
||||
initialize: jest.fn(_r => ({ ctx: 'authenticator' })),
|
||||
@@ -63,13 +64,17 @@ const baseConfig = {
|
||||
};
|
||||
|
||||
function wrapInApp(handlers: AuthProviderRouteHandlers) {
|
||||
const middleware = MiddlewareFactory.create({
|
||||
logger: mockServices.logger.mock(),
|
||||
config: mockServices.rootConfig(),
|
||||
});
|
||||
const app = express();
|
||||
|
||||
const router = PromiseRouter();
|
||||
|
||||
router.use(cookieParser());
|
||||
app.use('/my-provider', router);
|
||||
app.use(errorHandler());
|
||||
app.use(middleware.error());
|
||||
|
||||
router.get('/start', handlers.start.bind(handlers));
|
||||
router.get('/handler/frame', handlers.frameHandler.bind(handlers));
|
||||
|
||||
Reference in New Issue
Block a user