From 38b4d2f5386835200c9296e580a3a1fea1f6762f Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 20 Aug 2024 13:53:48 +0800 Subject: [PATCH] test: add unit test case --- .../vutils/__tests__/common/merge.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/vutils/__tests__/common/merge.test.ts b/packages/vutils/__tests__/common/merge.test.ts index f4a8b9f..c4be6ef 100644 --- a/packages/vutils/__tests__/common/merge.test.ts +++ b/packages/vutils/__tests__/common/merge.test.ts @@ -53,6 +53,29 @@ describe('merge', () => { } }); + expect(result).toEqual(expected); + }); + it('null value in target should not throw error', function () { + const target: any = { + style: { + stroke: null + } + }; + + const source = { + style: { + stroke: { type: 'palette', key: 'color1' } + } + }; + + const expected = { + style: { + stroke: { type: 'palette', key: 'color1' } + } + }; + + const result = merge(target, source); + expect(result).toEqual(expected); }); });