tests arreglados

This commit is contained in:
Daniel Herrero 2017-11-30 10:13:34 +01:00
parent 83301070e7
commit ea9c5f3457
3 changed files with 11 additions and 14 deletions

View File

@ -72,8 +72,8 @@ describe('Client', () => {
describe('returnDialog()', () => {
it('should request to send notification email', () => {
controller.client = {id: '123'};
$httpBackend.when('POST', `/mailer/manuscript/payment-update/${controller.client.id}`).respond('done');
$httpBackend.expectPOST(`/mailer/manuscript/payment-update/${controller.client.id}`);
$httpBackend.when('POST', `/mailer/notification/payment-update/${controller.client.id}`).respond('done');
$httpBackend.expectPOST(`/mailer/notification/payment-update/${controller.client.id}`);
controller.returnDialog('ACCEPT');
$httpBackend.flush();
});

View File

@ -3,6 +3,7 @@ import './column-header.js';
describe('Component vnColumnHeader', () => {
let $componentController;
let controller;
let $attrs;
beforeEach(() => {
angular.mock.module('client');
@ -10,7 +11,8 @@ describe('Component vnColumnHeader', () => {
beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_;
controller = $componentController('vnColumnHeader', {});
$attrs = {};
controller = $componentController('vnColumnHeader', {$attrs});
}));
describe('onClick()', () => {

View File

@ -140,14 +140,6 @@ describe('Component vnDropDown', () => {
});
describe('$onChanges()', () => {
it(`should set the top css of the $element`, () => {
let argumentObject = {show: true, top: {currentValue: 100}};
spyOn(controller.$element, 'css');
controller.$onChanges(argumentObject);
expect(controller.$element.css).toHaveBeenCalledWith('top', '100px');
});
it(`should set the width css of the $element`, () => {
let argumentObject = {show: true, itemWidth: {currentValue: 100}};
spyOn(controller.$element, 'css');
@ -295,21 +287,24 @@ describe('Component vnDropDown', () => {
controller.selectItem(item);
expect(controller.selected).toEqual(item);
expect(controller._show).toEqual(true);
expect(controller._show).not.toBeDefined();
});
});
describe('loadItems()', () => {
it(`should set controller._show to true`, () => {
it(`should set controller.show to true`, () => {
controller.show = false;
controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}];
controller.loadItems();
expect(controller._show).toEqual(true);
expect(controller.show).toEqual(true);
});
it(`should call loadMore() and then set controller._show to true`, () => {
controller.showLoadMore = () => {};
controller.loadMore = () => {};
spyOn(controller, 'loadMore');
controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}];
controller.loadItems();
expect(controller._show).toEqual(true);