2021-03-03 06:44:09 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
2021-09-24 06:24:34 +00:00
|
|
|
|
|
|
|
describe('toBook()', () => {
|
|
|
|
it(`should perform a post query to book the invoiSce`, () => {
|
|
|
|
const id = 1;
|
|
|
|
const response = {id: 1};
|
|
|
|
|
|
|
|
$httpBackend.expectPOST(`InvoiceIns/${id}/toBook`).respond(response);
|
|
|
|
controller.id = id;
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.invoiceIn).toEqual(response);
|
|
|
|
});
|
|
|
|
});
|
2021-03-03 06:44:09 +00:00
|
|
|
});
|