diff --git a/package.json b/package.json index 598e011..7577eda 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,17 @@ "transform": { "^.+\\.js$": "/node_modules/babel-jest", ".*\\.(vue)$": "/node_modules/jest-vue-preprocessor" + }, + "globals": { + "snowdog": { + "baseUrl": "global-base-url" + } } }, "dependencies": { "axios": "^0.18.0", "vue": "^2.4.4", + "vue-i18n": "^8.4.0", "vue-multiselect": "^2.1.0", "vuelidate": "^0.7.4", "vuex": "^3.0.0" @@ -41,7 +47,7 @@ "eslint": "^4.19.1", "eslint-config-standard": "^11.0.0", "eslint-loader": "^2.0.0", - "eslint-plugin-import": "^2.10.0", + "eslint-plugin-import": "^2.13.0", "eslint-plugin-node": "^6.0.1", "eslint-plugin-promise": "^3.7.0", "eslint-plugin-standard": "^3.0.1", diff --git a/test/ProductsList.test.js b/test/ProductsList.test.js index 502a4de..1777c68 100644 --- a/test/ProductsList.test.js +++ b/test/ProductsList.test.js @@ -1,7 +1,16 @@ import Vue from 'vue' -import { mount } from '@vue/test-utils' +import Vuei18n from 'vue-i18n' +import { mount, createLocalVue } from '@vue/test-utils' +import messages from '../view/frontend/web/js/data/translations-en_US.json' import ProductsList from '../view/frontend/web/js/components/ProductsList.vue' +const localVue = createLocalVue() +localVue.use(Vuei18n) +const i18n = new Vuei18n({ + locale: 'en_US', + messages +}) + Vue.filter('currency', function (price) { const pattern = '$%s' price = parseFloat(price).toFixed(2) @@ -9,7 +18,6 @@ Vue.filter('currency', function (price) { }) describe('ProductsList.test.js', () => { - let wrapper beforeEach(() => { @@ -41,7 +49,9 @@ describe('ProductsList.test.js', () => { } ], step: () => 'shipping' - } + }, + localVue, + i18n }) }) diff --git a/test/__snapshots__/ProductsList.test.js.snap b/test/__snapshots__/ProductsList.test.js.snap index fe257e2..b694b2d 100644 --- a/test/__snapshots__/ProductsList.test.js.snap +++ b/test/__snapshots__/ProductsList.test.js.snap @@ -34,6 +34,7 @@ exports[`ProductsList.test.js has the expected html structure 1`] = ` > Price: + diff --git a/view/frontend/templates/onepage.phtml b/view/frontend/templates/onepage.phtml index ee08fd2..6e33309 100644 --- a/view/frontend/templates/onepage.phtml +++ b/view/frontend/templates/onepage.phtml @@ -1,8 +1,16 @@ +get('Magento\Framework\Locale\Resolver'); +?> +