50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
import './index.js';
|
|
|
|
fdescribe('InvoiceIn', () => {
|
|
describe('Component vnInvoiceInCreate', () => {
|
|
let controller;
|
|
let $element;
|
|
|
|
beforeEach(ngModule('invoiceIn'));
|
|
|
|
beforeEach(inject(($componentController, $compile, $rootScope) => {
|
|
$element = angular.element(`<vn-invoice-in-create></vn-invoice-in-create>`);
|
|
console.log($element);
|
|
controller = $componentController('vnInvoiceInCreate', {$element});
|
|
// controller = $element.controller('Controller');
|
|
}));
|
|
|
|
afterEach(() => {
|
|
$element.remove();
|
|
});
|
|
|
|
describe('onSubmit()', () => {
|
|
it(`should call createInvoiceIn()`, () => {
|
|
jest.spyOn(controller, 'createInvoiceIn');
|
|
controller.onSubmit();
|
|
|
|
expect(controller.createInvoiceIn).toHaveBeenCalledWith();
|
|
});
|
|
});
|
|
|
|
describe('onInit()', () => {
|
|
it(`should define invoiceIn supplierFk with params values()`, () => {
|
|
controller.params = 'supplierId';
|
|
controller.$onInit();
|
|
|
|
expect(controller.invoiceIn.supplierFk).toEqual('supplierId');
|
|
});
|
|
});
|
|
|
|
describe('set companyFk', () => {
|
|
it(`should set companyFk to a value`, () => {
|
|
console.log(controller);
|
|
controller.companyFk = 442;
|
|
|
|
expect(controller.companyFk).toEqual(442);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|