fix tests

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-23 14:33:35 +01:00
parent a561569a10
commit 76e3cb1153
2 changed files with 5 additions and 5 deletions
@@ -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);