Fix tests for if condition in schema

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-06-07 10:13:09 +02:00
parent 4dba3594ae
commit 160daa72bb
@@ -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/);
});
});