From 6431dd787f86c130d2cfe47ea5f9b95da346af6a Mon Sep 17 00:00:00 2001 From: seven Date: Mon, 23 Sep 2024 18:35:48 +0800 Subject: [PATCH] test: add more test #5 Signed-off-by: seven --- tests/stack/validate.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/stack/validate.test.ts b/tests/stack/validate.test.ts index e89b09f..5f2cfd6 100644 --- a/tests/stack/validate.test.ts +++ b/tests/stack/validate.test.ts @@ -106,7 +106,15 @@ describe('unit test for validate', () => { target: 'hello', }, }, - }; - expect(() => validateYaml(invalidYaml as unknown as RawServerlessIac)).toThrow('Invalid yaml'); + } as unknown as RawServerlessIac; + expect(() => validateYaml(invalidYaml)).toThrow('Invalid yaml'); + }); + + it('should throw error when functions are not specified', () => { + const invalidYaml = { + ...jsonIac, + functions: null, + } as unknown as RawServerlessIac; + expect(() => validateYaml(invalidYaml)).toThrow('Invalid yaml'); }); });