Skip to content

Commit 30f971b

Browse files
committed
test: improve tests for ignoring prototype methods when using setData
1 parent 00ec76d commit 30f971b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

tests/setData.spec.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ describe('setData', () => {
247247
expect(wrapper.vm.getResult()).toStrictEqual(`test2: ${expectedResult}`)
248248
})
249249

250-
it('should be possible to replace a primitive value with another', async () => {
250+
// https://github.com/vuejs/test-utils/issues/2257
251+
it('should ignore prototype methods when using setData on objects', async () => {
251252
const wrapper = mount(
252253
defineComponent({
253254
template: '<div />',
@@ -261,18 +262,13 @@ describe('setData', () => {
261262
)
262263

263264
await wrapper.setData({
264-
firstArray: [],
265-
secondArray: []
265+
firstArray: [1, 2],
266+
secondArray: [3, 4]
266267
})
267268

268269
expect(wrapper.vm.$data).toStrictEqual({
269-
firstArray: [],
270-
secondArray: []
270+
firstArray: [1, 2],
271+
secondArray: [3, 4]
271272
})
272-
273-
expect(Object.keys(wrapper.vm.$data)).toStrictEqual([
274-
'firstArray',
275-
'secondArray'
276-
])
277273
})
278274
})

0 commit comments

Comments
 (0)