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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mocks mounting option #49

Merged
merged 4 commits into from Apr 8, 2020
Merged

feat: mocks mounting option #49

merged 4 commits into from Apr 8, 2020

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.

None yet

2 participants