diff options
author | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-09 21:03:09 +0300 |
---|---|---|
committer | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-17 07:57:29 +0300 |
commit | 6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch) | |
tree | e7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/u2f | |
parent | 28d412e5b2b8499fba22e8fabb1d44f44449228e (diff) |
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/u2f')
-rw-r--r-- | spec/javascripts/u2f/authenticate_spec.js | 6 | ||||
-rw-r--r-- | spec/javascripts/u2f/register_spec.js | 18 | ||||
-rw-r--r-- | spec/javascripts/u2f/util_spec.js | 8 |
3 files changed, 25 insertions, 7 deletions
diff --git a/spec/javascripts/u2f/authenticate_spec.js b/spec/javascripts/u2f/authenticate_spec.js index 57e0caa692c..abe28f28dca 100644 --- a/spec/javascripts/u2f/authenticate_spec.js +++ b/spec/javascripts/u2f/authenticate_spec.js @@ -51,10 +51,12 @@ describe('U2FAuthenticate', function () { it('allows authenticating via a U2F device', () => { const inProgressMessage = this.container.find('p'); + expect(inProgressMessage.text()).toContain('Trying to communicate with your device'); this.u2fDevice.respondToAuthenticateRequest({ deviceData: 'this is data from the device', }); + expect(this.component.renderAuthenticated).toHaveBeenCalledWith('{"deviceData":"this is data from the device"}'); }); @@ -66,7 +68,8 @@ describe('U2FAuthenticate', function () { errorCode: 'error!', }); const errorMessage = this.container.find('p'); - return expect(errorMessage.text()).toContain('There was a problem communicating with your device'); + + expect(errorMessage.text()).toContain('There was a problem communicating with your device'); }); return it('allows retrying authentication after an error', () => { let setupButton = this.container.find('#js-login-u2f-device'); @@ -81,6 +84,7 @@ describe('U2FAuthenticate', function () { this.u2fDevice.respondToAuthenticateRequest({ deviceData: 'this is data from the device', }); + expect(this.component.renderAuthenticated).toHaveBeenCalledWith('{"deviceData":"this is data from the device"}'); }); }); diff --git a/spec/javascripts/u2f/register_spec.js b/spec/javascripts/u2f/register_spec.js index b774627651f..4d90a3ccce6 100644 --- a/spec/javascripts/u2f/register_spec.js +++ b/spec/javascripts/u2f/register_spec.js @@ -16,20 +16,23 @@ describe('U2FRegister', function () { it('allows registering a U2F device', () => { const setupButton = this.container.find('#js-setup-u2f-device'); + expect(setupButton.text()).toBe('Set up new U2F device'); setupButton.trigger('click'); const inProgressMessage = this.container.children('p'); + expect(inProgressMessage.text()).toContain('Trying to communicate with your device'); this.u2fDevice.respondToRegisterRequest({ deviceData: 'this is data from the device', }); const registeredMessage = this.container.find('p'); const deviceResponse = this.container.find('#js-device-response'); + expect(registeredMessage.text()).toContain('Your device was successfully set up!'); - return expect(deviceResponse.val()).toBe('{"deviceData":"this is data from the device"}'); + expect(deviceResponse.val()).toBe('{"deviceData":"this is data from the device"}'); }); - return describe('errors', () => { + describe('errors', () => { it('doesn\'t allow the same device to be registered twice (for the same user', () => { const setupButton = this.container.find('#js-setup-u2f-device'); setupButton.trigger('click'); @@ -37,7 +40,8 @@ describe('U2FRegister', function () { errorCode: 4, }); const errorMessage = this.container.find('p'); - return expect(errorMessage.text()).toContain('already been registered with us'); + + expect(errorMessage.text()).toContain('already been registered with us'); }); it('displays an error message for other errors', () => { @@ -47,10 +51,11 @@ describe('U2FRegister', function () { errorCode: 'error!', }); const errorMessage = this.container.find('p'); - return expect(errorMessage.text()).toContain('There was a problem communicating with your device'); + + expect(errorMessage.text()).toContain('There was a problem communicating with your device'); }); - return it('allows retrying registration after an error', () => { + it('allows retrying registration after an error', () => { let setupButton = this.container.find('#js-setup-u2f-device'); setupButton.trigger('click'); this.u2fDevice.respondToRegisterRequest({ @@ -64,7 +69,8 @@ describe('U2FRegister', function () { deviceData: 'this is data from the device', }); const registeredMessage = this.container.find('p'); - return expect(registeredMessage.text()).toContain('Your device was successfully set up!'); + + expect(registeredMessage.text()).toContain('Your device was successfully set up!'); }); }); }); diff --git a/spec/javascripts/u2f/util_spec.js b/spec/javascripts/u2f/util_spec.js index 4187183236f..d1a64348da6 100644 --- a/spec/javascripts/u2f/util_spec.js +++ b/spec/javascripts/u2f/util_spec.js @@ -4,41 +4,49 @@ describe('U2F Utils', () => { describe('canInjectU2fApi', () => { it('returns false for Chrome < 41', () => { const userAgent = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.28 Safari/537.36'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); it('returns true for Chrome >= 41', () => { const userAgent = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'; + expect(canInjectU2fApi(userAgent)).toBe(true); }); it('returns false for Opera < 40', () => { const userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36 OPR/32.0.1948.25'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); it('returns true for Opera >= 40', () => { const userAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.991'; + expect(canInjectU2fApi(userAgent)).toBe(true); }); it('returns false for Safari', () => { const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); it('returns false for Chrome on Android', () => { const userAgent = 'Mozilla/5.0 (Linux; Android 7.0; VS988 Build/NRD90U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3145.0 Mobile Safari/537.36'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); it('returns false for Chrome on iOS', () => { const userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); it('returns false for Safari on iOS', () => { const userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A356 Safari/604.1'; + expect(canInjectU2fApi(userAgent)).toBe(false); }); }); |