-
Notifications
You must be signed in to change notification settings - Fork 111
Add additionalOptions test example #49
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
Comments
I can work on this as I actually implemented myself today. Not sure if I did it correctly or not though. import Vue from 'vue'
import Vuei18n from 'vue-i18n'
import ja from '@/translations/ja'
Vue.use(Vuei18n)
const i18n = new Vuei18n({
locale: 'en',
messages: {
ja,
},
})
import {cleanup, render, fireEvent} from '@testing-library/vue'
afterEach(cleanup)
test('can navigate to signup page from welcome page', async () => {
const {queryByTestId, getByText, debug} = render(
App,
{
routes,
store,
i18n,
},
vue => vue.use(Vuei18n),
)
}) If theres a better way let me know and I can tidy this up and add to the tests |
Hi! Thank you for taking this :) Notice how, in your snippet, you are using an external Vue instance to register i18n, so you are not actually using the instance exposed by Vue Testing Library. Notice how, in issue #47, the example suggests returning Long story short: You shouldn't import and use external Vue, but rather use the Vue instance provided in the callback function. Then, create the config there, and return the desired object keys. If you want, open up a PR and we can work from there :) Thanks! |
Hi! Yes, I was sure that I should not be importing the external Vue to create the i18n instance but could not figure out how to create it any other way. I had not seen #47 at the time but that is clearly the correct way to create it. Il adjust things and create a PR over the weekend. |
Closed in #58 |
Adding a test example for
additionalOptions
feature (#48 #47) would both (1) show how to use it and (2) increase code coverage.I guess using
vue-i18n
as a example would be great.The text was updated successfully, but these errors were encountered: