Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stubbing computed property for another computed unit test #145

Open
jonnyparris opened this issue Oct 3, 2017 · 0 comments
Open

Stubbing computed property for another computed unit test #145

jonnyparris opened this issue Oct 3, 2017 · 0 comments

Comments

@jonnyparris
Copy link

Hello - how should I stub the value of a computed property in a unit test?

I've got a computed method on my component:

visibleRows () {
  return this.sortedRows.slice(this.firstVisibleRowIndex, this.lastVisibleRowIndex);
},

that I've tried testing with the following:

wrapper.setData({
  sortedRows: dummyData.data
});
assert.equal(wrapper.vm.visibleRows, dummyData.data.slice(0, 4));

However, sortedRows logs as empty within the visibleRows method when the unit test runs.
Any help much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants