0

I've got a test that during it's setup process I pass some default props to the component. Then, in the test, I use setProps to pass more specific data into it. Issue is that both default and new data are nested within same props object named org and Vue obviously complains that the default is getting overwritten. Is there a way around this?

[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "optimisticClearFilters"

Here's an example. When I do this from test, it seems to override all org keys.

wrapper.setProps( { org: { deptSize: [0, 5] }} );

urubuz
  • 352
  • 1
  • 13

1 Answers1

0

For example if I have:

var posts = {
  status: 6
  rows: [{}, {}, {}]
  details: "some details",
  amount: 1 
}

And I want to test component with changed status value without exception, I do:

post.status = status
wrapper.setProps({ post: { ...post} })