From fa21608801f8d2ef710d4c28abbb558883afeaf7 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Mon, 20 Feb 2017 14:37:37 -0300 Subject: [#907] Translate auth error message on login with @anikarni --- web-ui/test/unit/login/app.spec.js | 11 ++++++++++- web-ui/test/unit/util.spec.js | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 web-ui/test/unit/util.spec.js (limited to 'web-ui/test') diff --git a/web-ui/test/unit/login/app.spec.js b/web-ui/test/unit/login/app.spec.js index 3b6461cf..347e2b19 100644 --- a/web-ui/test/unit/login/app.spec.js +++ b/web-ui/test/unit/login/app.spec.js @@ -5,13 +5,22 @@ import { App } from 'src/login/app'; describe('App', () => { let app; + const mockTranslations = key => key; beforeEach(() => { - const mockTranslations = key => key; app = shallow(); }); it('renders login form', () => { expect(app.find('form').props().action).toEqual('/login'); }); + + it('renders auth error message', () => { + app = shallow(); + 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); + }); + }); +}); -- cgit v1.2.3