From 5cd3bde306c5dc7766a4a2fffe9f667b98dc4028 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 6 Feb 2020 14:59:00 +0100 Subject: [PATCH] ticketRequest front test --- modules/ticket/front/request/index/index.js | 2 + .../ticket/front/request/index/index.spec.js | 62 +++++++++++++++++++ .../ticket/front/request/index/locale/es.yml | 3 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 modules/ticket/front/request/index/index.spec.js diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index 38d800aeb..e8cb54f22 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -89,6 +89,8 @@ class Controller { isEditable(isOk) { if (isOk != null) return true; + + return false; } } diff --git a/modules/ticket/front/request/index/index.spec.js b/modules/ticket/front/request/index/index.spec.js new file mode 100644 index 000000000..90d71f062 --- /dev/null +++ b/modules/ticket/front/request/index/index.spec.js @@ -0,0 +1,62 @@ +import './index'; + +describe('Ticket', () => { + describe('Component vnTicketRequestIndex', () => { + let controller; + let $scope; + + beforeEach(ngModule('ticket')); + + beforeEach(angular.mock.inject(($componentController, $rootScope) => { + $scope = $rootScope.$new(); + + controller = $componentController('vnTicketRequestIndex', {$scope}); + })); + + describe('getRequestState()', () => { + it('should return New when the state is null', () => { + let state = null; + let result = controller.getRequestState(state); + + expect(result).toEqual('New'); + }); + + it('should return Denied when the state is false', () => { + let state = false; + let result = controller.getRequestState(state); + + expect(result).toEqual('Denied'); + }); + + it('should return Acepted when the state is true', () => { + let state = true; + let result = controller.getRequestState(state); + + expect(result).toEqual('Acepted'); + }); + }); + + describe('isEditable()', () => { + it('should return true when isOk is true', () => { + let isOk = true; + let result = controller.isEditable(isOk); + + expect(result).toEqual(true); + }); + + it('should return true when isOk is false', () => { + let isOk = false; + let result = controller.isEditable(isOk); + + expect(result).toEqual(true); + }); + + it('should return true when isOk is null', () => { + let isOk = null; + let result = controller.isEditable(isOk); + + expect(result).toEqual(false); + }); + }); + }); +}); diff --git a/modules/ticket/front/request/index/locale/es.yml b/modules/ticket/front/request/index/locale/es.yml index 65442cde1..1adcbad49 100644 --- a/modules/ticket/front/request/index/locale/es.yml +++ b/modules/ticket/front/request/index/locale/es.yml @@ -3,4 +3,5 @@ Atender: Comprador Remove request: Eliminar petición New request: Crear petición Sale id: Id linea -Requester: Solicitante \ No newline at end of file +Requester: Solicitante +New purchase request: Nueva petición de compra \ No newline at end of file