From 34f0f4c853172f62cafa67aae54e156b0effa5ab Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Wed, 8 Aug 2018 09:05:31 +0200 Subject: [PATCH] #476 web-access/index.js Front unit test --- client/client/src/web-access/index.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/client/src/web-access/index.spec.js b/client/client/src/web-access/index.spec.js index aec8ea72e..b0fda550f 100644 --- a/client/client/src/web-access/index.spec.js +++ b/client/client/src/web-access/index.spec.js @@ -44,6 +44,21 @@ describe('Component VnClientWebAccess', () => { }); }); + describe('checkConditions()', () => { + it(`should perform a query to check if the client is valid and then store a boolean into the controller`, () => { + controller.client = {id: '1234'}; + + expect(controller.canEnableCheckBox).toBeTruthy(); + + $httpBackend.when('GET', `/client/api/Clients/${controller.client.id}/isValidClient`).respond(false); + $httpBackend.expectGET(`/client/api/Clients/${controller.client.id}/isValidClient`); + controller.checkConditions(); + $httpBackend.flush(); + + expect(controller.canEnableCheckBox).toBeFalsy(); + }); + }); + describe('onPassOpen()', () => { it('should set passwords to empty values', () => { controller.newPassword = 'm24x8';