@@ -50,10 +50,10 @@ import request from 'supertest';
|
||||
import { createRouter, DatabaseTaskStore, TaskBroker } from '../index';
|
||||
import { StorageTaskBroker } from '../scaffolder/tasks/StorageTaskBroker';
|
||||
|
||||
const createCatalogClient = (templates: any[] = []) =>
|
||||
const createCatalogClient = (template: any) =>
|
||||
({
|
||||
getEntities: async () => ({ items: templates }),
|
||||
} as CatalogApi);
|
||||
getEntityByName: async () => template,
|
||||
} as unknown as CatalogApi);
|
||||
|
||||
function createDatabase(): PluginDatabaseManager {
|
||||
return DatabaseManager.fromConfig(
|
||||
@@ -120,7 +120,7 @@ describe('createRouter', () => {
|
||||
logger: getVoidLogger(),
|
||||
config: new ConfigReader({}),
|
||||
database: createDatabase(),
|
||||
catalogClient: createCatalogClient([template]),
|
||||
catalogClient: createCatalogClient(template),
|
||||
containerRunner: new DockerContainerRunner({} as any),
|
||||
reader: mockUrlReader,
|
||||
taskBroker,
|
||||
|
||||
@@ -179,7 +179,7 @@ export async function createRouter(
|
||||
})
|
||||
.post('/v2/tasks', async (req, res) => {
|
||||
const templateName: string = req.body.templateName;
|
||||
const kind = 'Template';
|
||||
const kind = 'template';
|
||||
const namespace = DEFAULT_NAMESPACE;
|
||||
const values = req.body.values;
|
||||
const token = getBearerToken(req.headers.authorization);
|
||||
|
||||
Reference in New Issue
Block a user