diff options
author | Anike Arni <anikarni@gmail.com> | 2017-02-21 18:39:06 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 18:39:06 -0300 |
commit | 92c6a9dbc39318df48b4b3d5fae1a3888f201343 (patch) | |
tree | 548fb92a6ae19d34945c19b2c704cc8c2c97382a /web-ui/test/unit | |
parent | d5d7c8607138c8f39b55cdaa6ef3231c98d6af8a (diff) | |
parent | db1db55b806953ff93950b724fc96c8db388bbcf (diff) |
Merge pull request #986 from pixelated/login-errors
Translate and make login responsive
Diffstat (limited to 'web-ui/test/unit')
-rw-r--r-- | web-ui/test/unit/login/app.spec.js | 26 | ||||
-rw-r--r-- | web-ui/test/unit/util.spec.js | 20 |
2 files changed, 46 insertions, 0 deletions
diff --git a/web-ui/test/unit/login/app.spec.js b/web-ui/test/unit/login/app.spec.js new file mode 100644 index 00000000..347e2b19 --- /dev/null +++ b/web-ui/test/unit/login/app.spec.js @@ -0,0 +1,26 @@ +import { shallow } from 'enzyme'; +import expect from 'expect'; +import React from 'react'; +import { App } from 'src/login/app'; + +describe('App', () => { + let app; + const mockTranslations = key => key; + + beforeEach(() => { + app = shallow(<App t={mockTranslations} />); + }); + + it('renders login form', () => { + expect(app.find('form').props().action).toEqual('/login'); + }); + + it('renders auth error message', () => { + app = shallow(<App t={mockTranslations} authError />); + expect(app.find('.error').length).toEqual(1); + }); + + it('does not render auth error message', () => { + expect(app.find('.error').length).toEqual(0); + }); +}); diff --git a/web-ui/test/unit/util.spec.js b/web-ui/test/unit/util.spec.js new file mode 100644 index 00000000..84decf6f --- /dev/null +++ b/web-ui/test/unit/util.spec.js @@ -0,0 +1,20 @@ +import expect from 'expect'; +import Util from 'src/util'; + +describe('Utils', () => { + describe('.hasQueryParameter', () => { + global.window = { + location: { + search: '?auth&lng=pt-BR' + } + }; + + it('checks if param included in query parameters', () => { + expect(Util.hasQueryParameter('auth')).toBe(true); + }); + + it('checks if param not included in query parameters', () => { + expect(Util.hasQueryParameter('error')).toBe(false); + }); + }); +}); |