Skip to content

Conversation

@lmiller1990
Copy link
Member

@lmiller1990 lmiller1990 commented Apr 7, 2020

Seems like a useful feature to keep. Thoughts? I prefer to use jest.mock, though. 🤔 global seems like the right place for this.

const mixin = {
beforeCreate() {
for (const [k, v] of Object.entries(options.global?.mocks)) {
this[k] = v
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised this worked so easily

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow this is quite smart

@afontcu
Copy link
Member

afontcu commented Apr 7, 2020

💡 would this work for Router, too? 🤔

@lmiller1990
Copy link
Member Author

@afontcu sure, I guess so! Let's try it. vue-router-next is available on @posva/vue-router-next. You can see an example in this app I made https://github.com/lmiller1990/vue-3-composition-api-course/blob/master/src/router/index.ts

I have been testing it so far with jest.mock see here https://github.com/lmiller1990/vue-3-composition-api-course/blob/00724ac51db111ce8a0cabcca1e8d848844bcdcc/src/components/NewUser.spec.ts#L8

@lmiller1990
Copy link
Member Author

ok so @afontcu it works. We will need to include the router-link-stub like we do in beta.

a2dd554

Seems fine, consistent w/ beta.

@lmiller1990 lmiller1990 merged commit ed65fd4 into master Apr 8, 2020
@lmiller1990 lmiller1990 deleted the feature/mocks branch April 8, 2020 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants