2595 - Added invoiceIn module #545

Merged
carlosjr merged 11 commits from 2595-invoiceIn-index into dev 2021-03-03 11:47:43 +00:00
4 changed files with 106 additions and 0 deletions
Showing only changes of commit e52f0eea92 - Show all commits

View File

@ -0,0 +1,27 @@
import './index.js';
describe('vnInvoiceIn', () => {
let controller;
let $httpBackend;
let data = {id: 1, name: 'fooName'};
beforeEach(ngModule('invoiceIn'));
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnInvoiceInCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'InvoiceIns/:id').respond(data);
}));
it('should request data and set it on the controller', () => {
controller.reload();
$httpBackend.flush();
expect(controller.invoiceIn).toEqual(data);
});
});

View File

@ -0,0 +1,26 @@
import './index';
describe('vnInvoiceInDescriptor', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('invoiceIn'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnInvoiceInDescriptor', {$element: null});
}));
describe('loadData()', () => {
it(`should perform a get query to store the invoice in data into the controller`, () => {
const id = 1;
const response = {id: 1};
$httpBackend.expectGET(`InvoiceIns/${id}`).respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.invoiceIn).toEqual(response);
});
});
});

View File

@ -0,0 +1,27 @@
import './index.js';
describe('vnInvoiceOut', () => {
let controller;
let $httpBackend;
let data = {id: 1, name: 'fooName'};
beforeEach(ngModule('invoiceOut'));
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnInvoiceOutCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'InvoiceOuts/:id').respond(data);
}));
it('should request data and set it on the controller', () => {
controller.reload();
$httpBackend.flush();
expect(controller.invoiceOut).toEqual(data);
});
});

View File

@ -0,0 +1,26 @@
import './index';
describe('vnInvoiceOutDescriptor', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('invoiceOut'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnInvoiceOutDescriptor', {$element: null});
}));
describe('loadData()', () => {
it(`should perform a get query to store the invoice in data into the controller`, () => {
const id = 1;
const response = {id: 1};
$httpBackend.expectGET(`InvoiceOuts/${id}`).respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.invoiceOut).toEqual(response);
});
});
});