Refactor step-one unit test

This commit is contained in:
gerard 2018-05-22 08:14:16 +02:00
parent 73104c4465
commit d21b57e536
2 changed files with 22 additions and 23 deletions

View File

@ -1,10 +1,9 @@
import ngModule from '../../module'; import ngModule from '../../module';
class Controller { class Controller {
constructor($scope, $http, $element, $translate, vnApp) { constructor($scope, $http, $translate, vnApp) {
this.$scope = $scope; this.$scope = $scope;
this.$http = $http; this.$http = $http;
this.$element = $element;
this.$translate = $translate; this.$translate = $translate;
this.vnApp = vnApp; this.vnApp = vnApp;
} }
@ -37,10 +36,10 @@ class Controller {
}; };
return this.$http.post(query, data).then(res => { return this.$http.post(query, data).then(res => {
if (res.data); if (res.data)
this.ticket.sale = res.data; this.ticket.sale = res.data;
return true return true;
}, res => { }, res => {
if (res.data.error.message === 'NO_AGENCY_AVAILABLE') if (res.data.error.message === 'NO_AGENCY_AVAILABLE')
this.vnApp.showError( this.vnApp.showError(
@ -55,7 +54,7 @@ class Controller {
} }
} }
Controller.$inject = ['$scope', '$http', '$element', '$translate', 'vnApp']; Controller.$inject = ['$scope', '$http', '$translate', 'vnApp'];
ngModule.component('vnTicketDataStepOne', { ngModule.component('vnTicketDataStepOne', {
template: require('./step-one.html'), template: require('./step-one.html'),