Skip to content

Commit

Permalink
fix types issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed May 29, 2024
1 parent 8166ec4 commit 76691f3
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface RouteDependencies {
config: SavedObjectConfig;
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
isServerless: boolean;
access: RouteAccess;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export function registerRoutes({
config,
coreUsageData,
logger,
isServerless,
access: internalOnServerless,
});
registerDeleteRoute(router, { config, coreUsageData, logger, access: internalOnServerless });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe('POST /api/saved_objects/_bulk_create with allowApiAccess true', () =>
const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient);
const logger = loggerMock.create();
const config = setupConfig(true);
registerBulkCreateRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerBulkCreateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ describe('POST /api/saved_objects/_bulk_delete with allowApiAccess as true', ()
const logger = loggerMock.create();

const config = setupConfig(true);
const access = 'public';

registerBulkDeleteRoute(router, { config, coreUsageData, logger });
registerBulkDeleteRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('POST /api/saved_objects/_bulk_get with allowApiAccess true', () => {
const logger = loggerMock.create();

const config = setupConfig(true);
registerBulkGetRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerBulkGetRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ describe('POST /api/saved_objects/_bulk_resolve with allowApiAccess true', () =>
const logger = loggerMock.create();

const config = setupConfig(true);
registerBulkResolveRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerBulkResolveRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ describe('PUT /api/saved_objects/_bulk_update with allowApiAccess true', () => {
const logger = loggerMock.create();

const config = setupConfig(true);
registerBulkUpdateRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerBulkUpdateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ describe('POST /api/saved_objects/{type} with allowApiAccess true', () => {
const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient);
const logger = loggerMock.create();
const config = setupConfig(true);

registerCreateRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerCreateRoute(router, { config, coreUsageData, logger, access });

handlerContext.savedObjects.typeRegistry.getType.mockImplementation((typename: string) => {
return testTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ describe('DELETE /api/saved_objects/{type}/{id} with allowApiAccess true', () =>
const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient);
const logger = loggerMock.create();
const config = setupConfig(true);
registerDeleteRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerDeleteRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ describe('GET /api/saved_objects/_find with allowApiAccess true', () => {
const logger = loggerMock.create();

const config = setupConfig(true);
const access = 'public';

registerFindRoute(router, { config, coreUsageData, logger });
registerFindRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ describe('GET /api/saved_objects/{type}/{id} with allowApiAccess true', () => {
const logger = loggerMock.create();

const config = setupConfig(true);
registerGetRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerGetRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ describe('GET /api/saved_objects/resolve/{type}/{id} with allowApiAccess true',
const logger = loggerMock.create();

const config = setupConfig(true);
const access = 'public';

registerResolveRoute(router, { config, coreUsageData, logger });
registerResolveRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe('PUT /api/saved_objects/{type}/{id?} with allowApiAccess true', () => {
const logger = loggerMock.create();

const config = setupConfig(true);
registerUpdateRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerUpdateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ describe('POST /api/saved_objects/_bulk_create', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
const access = 'public';

registerBulkCreateRoute(router, { config, coreUsageData, logger });
registerBulkCreateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ describe('POST /api/saved_objects/_bulk_delete', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
const access = 'public';

registerBulkDeleteRoute(router, { config, coreUsageData, logger });
registerBulkDeleteRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ describe('POST /api/saved_objects/_bulk_get', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
registerBulkGetRoute(router, { config, coreUsageData, logger });
const access = 'public';

registerBulkGetRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ describe('POST /api/saved_objects/_bulk_resolve', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
registerBulkResolveRoute(router, { config, coreUsageData, logger });
const access = 'public';

registerBulkResolveRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ describe('PUT /api/saved_objects/_bulk_update', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
registerBulkUpdateRoute(router, { config, coreUsageData, logger });
const access = 'public';

registerBulkUpdateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ describe('POST /api/saved_objects/{type}', () => {
const logger = loggerMock.create();
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();
const config = setupConfig();
registerCreateRoute(router, { config, coreUsageData, logger });
const access = 'public';

registerCreateRoute(router, { config, coreUsageData, logger, access });

handlerContext.savedObjects.typeRegistry.getType.mockImplementation((typename: string) => {
return testTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe('DELETE /api/saved_objects/{type}/{id}', () => {
const logger = loggerMock.create();
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();
const config = setupConfig();
registerDeleteRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerDeleteRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ describe('GET /api/saved_objects/_find', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
const access = 'public';

registerFindRoute(router, { config, coreUsageData, logger });
registerFindRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ describe('GET /api/saved_objects/{type}/{id}', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
registerGetRoute(router, { config, coreUsageData, logger });
const access = 'public';

registerGetRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ describe('GET /api/saved_objects/resolve/{type}/{id}', () => {
const logger = loggerMock.create();
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();
const config = setupConfig();
const access = 'public';

registerResolveRoute(router, { config, coreUsageData, logger });
registerResolveRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ describe('PUT /api/saved_objects/{type}/{id?}', () => {
loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation();

const config = setupConfig();
registerUpdateRoute(router, { config, coreUsageData, logger });
const access = 'public';
registerUpdateRoute(router, { config, coreUsageData, logger, access });

await server.start();
});
Expand Down

0 comments on commit 76691f3

Please sign in to comment.