refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="express" />
|
||||
/// <reference types="jest" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="qs" />
|
||||
|
||||
import { AuthService } from '@backstage/backend-plugin-api';
|
||||
import { Backend } from '@backstage/backend-app-api';
|
||||
@@ -18,6 +20,7 @@ import { BackstageUserPrincipal } from '@backstage/backend-plugin-api';
|
||||
import { CacheService } from '@backstage/backend-plugin-api';
|
||||
import { DatabaseService } from '@backstage/backend-plugin-api';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import { ErrorRequestHandler } from 'express';
|
||||
import { EventsService } from '@backstage/plugin-events-node';
|
||||
import { ExtendedHttpServer } from '@backstage/backend-defaults/rootHttpRouter';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
@@ -29,6 +32,8 @@ import Keyv from 'keyv';
|
||||
import { Knex } from 'knex';
|
||||
import { LifecycleService } from '@backstage/backend-plugin-api';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { ParamsDictionary } from 'express-serve-static-core';
|
||||
import { ParsedQs } from 'qs';
|
||||
import { PermissionsService } from '@backstage/backend-plugin-api';
|
||||
import { RootConfigService } from '@backstage/backend-plugin-api';
|
||||
import { RootHealthService } from '@backstage/backend-plugin-api';
|
||||
@@ -139,6 +144,15 @@ export interface MockDirectoryContentOptions {
|
||||
shouldReadAsText?: boolean | ((path: string, buffer: Buffer) => boolean);
|
||||
}
|
||||
|
||||
// @public
|
||||
export function mockErrorHandler(): ErrorRequestHandler<
|
||||
ParamsDictionary,
|
||||
any,
|
||||
any,
|
||||
ParsedQs,
|
||||
Record<string, any>
|
||||
>;
|
||||
|
||||
// @public (undocumented)
|
||||
export namespace mockServices {
|
||||
// (undocumented)
|
||||
|
||||
@@ -55,7 +55,10 @@
|
||||
"@backstage/types": "workspace:^",
|
||||
"@keyv/memcache": "^1.3.5",
|
||||
"@keyv/redis": "^2.5.3",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/express-serve-static-core": "^4.17.5",
|
||||
"@types/keyv": "^4.2.0",
|
||||
"@types/qs": "^6.9.6",
|
||||
"better-sqlite3": "^11.0.0",
|
||||
"cookie": "^0.6.0",
|
||||
"express": "^4.17.1",
|
||||
|
||||
@@ -25,3 +25,4 @@ export * from './database';
|
||||
export * from './msw';
|
||||
export * from './filesystem';
|
||||
export * from './next';
|
||||
export { mockErrorHandler } from './util';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
|
||||
import { mockServices } from '../next';
|
||||
|
||||
/**
|
||||
* A mock for error handler middleware that can be used in router tests.
|
||||
* @public
|
||||
*/
|
||||
export function mockErrorHandler() {
|
||||
return MiddlewareFactory.create({
|
||||
config: mockServices.rootConfig(),
|
||||
logger: mockServices.rootLogger(),
|
||||
}).error();
|
||||
}
|
||||
@@ -14,4 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { mockErrorHandler } from './errorHandler';
|
||||
export { isDockerDisabledForTests } from './isDockerDisabledForTests';
|
||||
|
||||
Reference in New Issue
Block a user