diff --git a/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.test.ts b/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.test.ts index 52951c793a..ce9ed8bedd 100644 --- a/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.test.ts +++ b/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.test.ts @@ -32,7 +32,8 @@ describe('TemplateEntityV1alpah1', () => { name: 'test', }, spec: { - type: 'cookiecutter', + type: 'website', + templater: 'cookiecutter', schema: { $schema: 'http://json-schema.org/draft-07/schema#', required: ['storePath', 'owner'], @@ -78,7 +79,7 @@ describe('TemplateEntityV1alpah1', () => { await expect(policy.enforce(entity)).rejects.toThrow(/type/); }); - it('acceptps any other type', async () => { + it('accepts any other type', async () => { (entity as any).spec.type = 'hallo'; await expect(policy.enforce(entity)).resolves.toBe(entity); }); @@ -87,4 +88,9 @@ describe('TemplateEntityV1alpah1', () => { (entity as any).spec.type = ''; await expect(policy.enforce(entity)).rejects.toThrow(/type/); }); + + it('rejects missing templater', async () => { + (entity as any).spec.templater = ''; + await expect(policy.enforce(entity)).rejects.toThrow(/templater/); + }); }); diff --git a/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.ts b/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.ts index c2f071b7c3..8aa79d57db 100644 --- a/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.ts +++ b/packages/catalog-model/src/kinds/TemplateEntityV1alpha1.ts @@ -26,6 +26,7 @@ export interface TemplateEntityV1alpha1 extends Entity { kind: typeof KIND; spec: { type: string; + templater: string; path?: string; schema: JSONSchema; }; @@ -43,6 +44,7 @@ export class TemplateEntityV1alpha1Policy implements EntityPolicy { type: yup.string().required().min(1), path: yup.string(), schema: yup.object().required(), + templater: yup.string().required(), }) .required(), });