salix/modules/invoiceIn/front/create/index.spec.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-05-31 06:21:16 +00:00
import './index.js';
2021-06-04 06:24:33 +00:00
fdescribe('InvoiceIn', () => {
2021-06-01 08:10:09 +00:00
describe('Component vnInvoiceInCreate', () => {
2021-05-31 06:21:16 +00:00
let controller;
2021-06-04 06:24:33 +00:00
let $element;
2021-05-31 06:21:16 +00:00
2021-06-01 08:10:09 +00:00
beforeEach(ngModule('invoiceIn'));
2021-05-31 06:21:16 +00:00
2021-06-04 06:24:33 +00:00
beforeEach(inject(($componentController, $compile, $rootScope) => {
$element = angular.element(`<vn-invoice-in-create></vn-invoice-in-create>`);
2021-06-01 08:10:09 +00:00
console.log($element);
2021-06-04 06:24:33 +00:00
controller = $componentController('vnInvoiceInCreate', {$element});
// controller = $element.controller('Controller');
2021-05-31 06:21:16 +00:00
}));
2021-06-04 06:24:33 +00:00
afterEach(() => {
$element.remove();
});
2021-05-31 06:21:16 +00:00
describe('onSubmit()', () => {
2021-06-01 08:10:09 +00:00
it(`should call createInvoiceIn()`, () => {
2021-06-04 06:24:33 +00:00
jest.spyOn(controller, 'createInvoiceIn');
2021-05-31 06:21:16 +00:00
controller.onSubmit();
2021-06-04 06:24:33 +00:00
expect(controller.createInvoiceIn).toHaveBeenCalledWith();
2021-05-31 06:21:16 +00:00
});
2021-06-04 06:24:33 +00:00
});
2021-05-31 06:21:16 +00:00
2021-06-04 06:24:33 +00:00
describe('onInit()', () => {
it(`should define invoiceIn supplierFk with params values()`, () => {
controller.params = 'supplierId';
controller.$onInit();
2021-05-31 06:21:16 +00:00
2021-06-04 06:24:33 +00:00
expect(controller.invoiceIn.supplierFk).toEqual('supplierId');
2021-06-01 08:10:09 +00:00
});
});
describe('set companyFk', () => {
it(`should set companyFk to a value`, () => {
2021-06-04 06:24:33 +00:00
console.log(controller);
2021-06-01 08:10:09 +00:00
controller.companyFk = 442;
expect(controller.companyFk).toEqual(442);
2021-05-31 06:21:16 +00:00
});
});
});
});