From fd05fa7c78ff2d204a0425f4e9f7d596e9222412 Mon Sep 17 00:00:00 2001 From: Roman Filippov Date: Sun, 10 Dec 2023 21:47:49 +0000 Subject: [PATCH] test: adds null and undefined tests --- lib/util/template/index.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/util/template/index.spec.ts b/lib/util/template/index.spec.ts index 9630f38166524e..0b86af09154cf1 100644 --- a/lib/util/template/index.spec.ts +++ b/lib/util/template/index.spec.ts @@ -227,6 +227,20 @@ describe('util/template/index', () => { ); expect(output).toBe('QGZzb3V6YS9wcmV0dGllcmQ='); }); + + it('handles null values gracefully', () => { + const output = template.compile('{{{encodeBase64 packageName}}}', { + packageName: null, + }); + expect(output).toBe(''); + }); + + it('handles undefined values gracefully', () => { + const output = template.compile('{{{encodeBase64 packageName}}}', { + packageName: undefined, + }); + expect(output).toBe(''); + }); }); describe('equals', () => {