Skip to content

Commit

Permalink
fix tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhammer committed Feb 25, 2024
1 parent 6c954a6 commit 6186dae
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/awards-backend/src/awards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Awards', () => {
.mockImplementation(
async (
request: GetEntitiesByRefsRequest,
options?: CatalogRequestOptions,
_?: CatalogRequestOptions,
) => {
return {
items: request.entityRefs.map(makeUser),
Expand Down
13 changes: 12 additions & 1 deletion plugins/awards-backend/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ export const awardsPlugin = createBackendPlugin({
identity: coreServices.identity,
logger: coreServices.logger,
httpRouter: coreServices.httpRouter,
discovery: coreServices.discovery,
tokenManager: coreServices.tokenManager,
},
async init({ database, identity, logger, httpRouter }) {
async init({
database,
identity,
logger,
httpRouter,
discovery,
tokenManager,
}) {
httpRouter.use(
await createRouter({
database,
identity,
logger: loggerToWinstonLogger(logger),
discovery,
tokenManager,
}),
);
},
Expand Down
9 changes: 8 additions & 1 deletion plugins/awards-backend/src/service/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ describe('backend router', () => {
).forPlugin('awards');
const dbm = await createDatabaseManager();
db = await dbm.getClient();

const router = await createRouter({
logger: getVoidLogger(),
identity: { getIdentity },
database: dbm,
discovery: {
getBaseUrl: jest.fn().mockResolvedValue('/'),
getExternalBaseUrl: jest.fn().mockResolvedValue('/'),
},
tokenManager: {
authenticate: jest.fn(),
getToken: jest.fn().mockResolvedValue({ token: 'token' }),
},
});
app = express().use(router);

Expand Down
6 changes: 6 additions & 0 deletions plugins/awards-backend/src/service/standaloneServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {
DatabaseManager,
HostDiscovery,
ServerTokenManager,
createServiceBuilder,
loadBackendConfig,
} from '@backstage/backend-common';
Expand Down Expand Up @@ -45,6 +46,11 @@ export async function startStandaloneServer(
database,
identity,
logger,
config,
discovery,
tokenManager: ServerTokenManager.fromConfig(config, {
logger,
}),
});

let service = createServiceBuilder(module)
Expand Down

0 comments on commit 6186dae

Please sign in to comment.