Skip to content

Commit

Permalink
test: improve tests for ignoring prototype methods when using setData
Browse files Browse the repository at this point in the history
  • Loading branch information
Haberkamp committed Dec 4, 2023
1 parent 00ec76d commit 30f971b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/setData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<div />',
Expand All @@ -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'
])
})
})

0 comments on commit 30f971b

Please sign in to comment.