From 160daa72bbf1a50864b807a5ac325f8a81004869 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Mon, 7 Jun 2021 10:13:09 +0200 Subject: [PATCH] Fix tests for if condition in schema Signed-off-by: Oliver Sand --- .../src/kinds/TemplateEntityV1beta2.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts index 2571cc947e..0be0289d84 100644 --- a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts +++ b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts @@ -145,7 +145,17 @@ describe('templateEntityV1beta2Validator', () => { }); it('accepts boolean in if', async () => { - (entity as any).spec.if = true; + (entity as any).spec.steps[0].if = true; await expect(validator.check(entity)).resolves.toBe(true); }); + + it('accepts emty if', async () => { + (entity as any).spec.steps[0].if = ''; + await expect(validator.check(entity)).resolves.toBe(true); + }); + + it('rejects wrong type if', async () => { + (entity as any).spec.steps[0].if = 5; + await expect(validator.check(entity)).rejects.toThrow(/if/); + }); });