front tests fixed
This commit is contained in:
parent
508534d2fd
commit
3d383b806a
|
@ -1,5 +1,5 @@
|
|||
import './index';
|
||||
import {watcher} from '../../../../helpers/watcherHelper';
|
||||
import {watcher} from '../../../helpers/watcherHelper';
|
||||
|
||||
describe('Agency', () => {
|
||||
describe('Component vnZoneCreate', () => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue