refactor: apply review suggestions

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-08-26 12:21:07 +02:00
parent 5b679ac14c
commit 40b9ef23b9
4 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ import { HttpAuthService } from '@backstage/backend-plugin-api';
import { Knex } from 'knex';
import { Logger } from 'winston';
import { Permission } from '@backstage/plugin-permission-common';
import { PluginCacheManager } from '@backstage/backend-defaults/cache';
import { PluginCacheManager } from '@backstage/backend-common';
import { PreparerBuilder } from '@backstage/plugin-techdocs-node';
import { PublisherBase } from '@backstage/plugin-techdocs-node';
import type { TechDocsCollatorFactoryOptions as TechDocsCollatorFactoryOptions_2 } from '@backstage/plugin-search-backend-module-techdocs';
-1
View File
@@ -59,7 +59,6 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
@@ -28,10 +28,9 @@ import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
import { CachedEntityLoader } from './CachedEntityLoader';
import { createEventStream, createRouter, RouterOptions } from './router';
import { TechDocsCache } from '../cache';
import { mockServices } from '@backstage/backend-test-utils';
import { mockErrorHandler, mockServices } from '@backstage/backend-test-utils';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import { PluginCacheManager } from '@backstage/backend-defaults/cache';
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
jest.mock('@backstage/catalog-client');
jest.mock('@backstage/config');
@@ -74,11 +73,7 @@ const getMockHttpResponseFor = (content: string): Buffer => {
const createApp = async (options: RouterOptions) => {
const app = express();
app.use(await createRouter(options));
const errorHandler = MiddlewareFactory.create({
config: mockServices.rootConfig(),
logger: mockServices.rootLogger(),
}).error();
app.use(errorHandler);
app.use(mockErrorHandler());
return app;
};
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createLegacyAuthAdapters } from '@backstage/backend-common';
import {
createLegacyAuthAdapters,
PluginCacheManager,
} from '@backstage/backend-common';
import { CatalogClient } from '@backstage/catalog-client';
import { stringifyEntityRef } from '@backstage/catalog-model';
import { Config } from '@backstage/config';
@@ -39,7 +42,6 @@ import {
DiscoveryService,
HttpAuthService,
} from '@backstage/backend-plugin-api';
import { PluginCacheManager } from '@backstage/backend-defaults/cache';
/**
* Required dependencies for running TechDocs in the "out-of-the-box"