-
Notifications
You must be signed in to change notification settings - Fork 278
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
Using setData() with an object is causing Object prototype methods to be set as keys on the object.
To Reproduce
Stackblitz isn't loading for me. But here is hopefully a clear example:
const wrapper = mountFunction()
expect(wrapper.vm.filters).toEqual({
'workflow state': [],
'task state': [],
}) // ✔
expect(Object.keys(wrapper.vm.filters)).toEqual([
'workflow state',
'task state',
]) // ✔
await wrapper.setData({
filters: {
'workflow state': [],
'task state': [],
}
})
expect(Object.keys(wrapper.vm.filters)).toEqual([
'workflow state',
'task state',
]) // ✖- Expected
+ Received
Array [
"workflow state",
"task state",
+ "constructor",
+ "__defineGetter__",
+ "__defineSetter__",
+ "hasOwnProperty",
+ "__lookupGetter__",
+ "__lookupSetter__",
+ "isPrototypeOf",
+ "propertyIsEnumerable",
+ "toString",
+ "valueOf",
+ "toLocaleString",Expected behavior
Object prototype methods should not be set as keys on objects.
Related information:
"vue": "3.3.4",
"@vue/test-utils": "2.4.2",
"vitest": "0.34.6"
Additional context
I think this was introduced by #2166
anjarupnik, Haberkamp and BenSheltonhyshka
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers