diff options
Diffstat (limited to 'web-ui/test')
-rw-r--r-- | web-ui/test/integration/i18n.js | 14 | ||||
-rw-r--r-- | web-ui/test/integration/setup.js | 15 | ||||
-rw-r--r-- | web-ui/test/integration/translations.spec.js | 21 |
3 files changed, 50 insertions, 0 deletions
diff --git a/web-ui/test/integration/i18n.js b/web-ui/test/integration/i18n.js new file mode 100644 index 00000000..099df2d7 --- /dev/null +++ b/web-ui/test/integration/i18n.js @@ -0,0 +1,14 @@ +import i18n from 'i18next'; +import translations from '../../app/locales/en_US/translation.json'; + +i18n + .init({ + lng: 'en', + resources: { + en: { + translation: translations + } + } + }); + +export default i18n; diff --git a/web-ui/test/integration/setup.js b/web-ui/test/integration/setup.js new file mode 100644 index 00000000..49cd381e --- /dev/null +++ b/web-ui/test/integration/setup.js @@ -0,0 +1,15 @@ +// Enzyme setup file +// https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md +var jsdom = require('jsdom').jsdom; + +global.document = jsdom(''); +global.window = document.defaultView; +Object.keys(document.defaultView).forEach((property) => { + if (typeof global[property] === 'undefined') { + global[property] = document.defaultView[property]; + } +}); + +global.navigator = { + userAgent: 'node.js' +}; diff --git a/web-ui/test/integration/translations.spec.js b/web-ui/test/integration/translations.spec.js new file mode 100644 index 00000000..1173695d --- /dev/null +++ b/web-ui/test/integration/translations.spec.js @@ -0,0 +1,21 @@ +import { mount } from 'enzyme'; +import expect from 'expect'; +import React from 'react'; +import App from 'src/backup_account/app'; +import testI18n from './i18n' + +describe('App', () => { + let app; + + beforeEach(() => { + app = mount(<App i18n={testI18n} />); + }); + + it('renders translated header logout text', () => { + expect(app.find('header').text()).toContain('Logout'); + }); + + it('renders translated footer text', () => { + expect(app.find('footer').text()).toContain('Product in development. Feedback and issues to team@pixelated-project.org'); + }); +}); |