From bb0addebd5c4960e4b8a1db85a2358db39b581d4 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Thu, 9 Mar 2023 12:37:29 +0100 Subject: [PATCH] scaffolder: tests for validating tags Signed-off-by: Vincenzo Scamporlino --- .../scaffolder-common/src/TemplateEntityV1beta3.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/scaffolder-common/src/TemplateEntityV1beta3.test.ts b/plugins/scaffolder-common/src/TemplateEntityV1beta3.test.ts index a23d72f290..9358e08df5 100644 --- a/plugins/scaffolder-common/src/TemplateEntityV1beta3.test.ts +++ b/plugins/scaffolder-common/src/TemplateEntityV1beta3.test.ts @@ -163,12 +163,20 @@ describe('templateEntityV1beta3Validator', () => { }); it('rejects parameters with wrong backstage:permissions', async () => { + (entity.spec.parameters as TemplateParameter)[ + 'backstage:permissions' + ]!.tags = true as unknown as []; + expect(() => validator(entity)).toThrow(/must be array/); + (entity.spec.parameters as TemplateParameter)['backstage:permissions'] = true as {}; expect(() => validator(entity)).toThrow(/must be object/); }); it('rejects steps with wrong backstage:permissions', async () => { + entity.spec.steps[0]['backstage:permissions']!.tags = true as unknown as []; + expect(() => validator(entity)).toThrow(/must be array/); + entity.spec.steps[0]['backstage:permissions'] = true as {}; expect(() => validator(entity)).toThrow(/must be object/); });