2020-04-30 10:48:52 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('vnItemDescriptor', () => {
|
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
|
|
|
|
|
|
|
const item = {
|
|
|
|
id: 1,
|
|
|
|
itemType: {
|
|
|
|
warehouseFk: 1
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const stock = {
|
|
|
|
visible: 1,
|
|
|
|
available: 5
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(ngModule('item'));
|
|
|
|
|
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$httpBackend.whenRoute('GET', `Items/${item.id}/getVisibleAvailable`).respond(stock);
|
|
|
|
|
|
|
|
controller = $componentController('vnItemDescriptor', {$element: null});
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe('loadData()', () => {
|
|
|
|
it(`should perform a get query to store the item data into the controller`, () => {
|
|
|
|
$httpBackend.expectGET(`Items/${item.id}/getCard`).respond(item);
|
|
|
|
controller.id = item.id;
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.item).toEqual(item);
|
|
|
|
});
|
|
|
|
});
|
2020-05-26 08:37:52 +00:00
|
|
|
|
|
|
|
describe('updateStock()', () => {
|
|
|
|
it(`should perform a get query to store the item data into the controller`, () => {
|
|
|
|
$httpBackend.expectGET(`Items/${item.id}/getCard`).respond(item);
|
|
|
|
controller.id = item.id;
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.item).toEqual(item);
|
|
|
|
});
|
|
|
|
});
|
2020-04-30 10:48:52 +00:00
|
|
|
});
|