From 30f971bd4218522671fac26891d1ae43feef327c Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 4 Dec 2023 14:55:36 +0100 Subject: [PATCH] test: improve tests for ignoring prototype methods when using setData --- tests/setData.spec.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/setData.spec.ts b/tests/setData.spec.ts index 2fa20430d..ba4255b6d 100644 --- a/tests/setData.spec.ts +++ b/tests/setData.spec.ts @@ -247,7 +247,8 @@ describe('setData', () => { expect(wrapper.vm.getResult()).toStrictEqual(`test2: ${expectedResult}`) }) - it('should be possible to replace a primitive value with another', async () => { + // https://github.com/vuejs/test-utils/issues/2257 + it('should ignore prototype methods when using setData on objects', async () => { const wrapper = mount( defineComponent({ template: '
', @@ -261,18 +262,13 @@ describe('setData', () => { ) await wrapper.setData({ - firstArray: [], - secondArray: [] + firstArray: [1, 2], + secondArray: [3, 4] }) expect(wrapper.vm.$data).toStrictEqual({ - firstArray: [], - secondArray: [] + firstArray: [1, 2], + secondArray: [3, 4] }) - - expect(Object.keys(wrapper.vm.$data)).toStrictEqual([ - 'firstArray', - 'secondArray' - ]) }) })