front tests fixed

This commit is contained in:
Gerard 2018-12-10 08:43:57 +01:00
parent 508534d2fd
commit 3d383b806a
3 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import './index';
import {watcher} from '../../../../helpers/watcherHelper';
import {watcher} from '../../../helpers/watcherHelper';
describe('Agency', () => {
describe('Component vnZoneCreate', () => {

View File

@ -32,7 +32,7 @@ class Controller {
let json = encodeURIComponent(JSON.stringify(this.filter));
let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`;
this.$http.get(query).then(res => {
if (res.data) {
if (res.data && res.data.rows) {
if (res.data.rows.length == 0)
delete res.data.rows;
this.order = res.data;

View File

@ -26,11 +26,11 @@ describe('Order', () => {
it(`should make a query, save the data in order and call get order if the response has data`, () => {
spyOn(controller, 'getTotal');
let json = encodeURIComponent(JSON.stringify(controller.filter));
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({id: 1});
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({rows: [1, 2, 3]});
controller.getCard();
$httpBackend.flush();
expect(controller.order).toEqual({id: 1});
expect(controller.order).toEqual({rows: [1, 2, 3]});
expect(controller.getTotal).toHaveBeenCalledWith();
});