2018-05-25 08:03:45 +00:00
|
|
|
import './index.js';
|
2018-02-05 15:53:41 +00:00
|
|
|
|
|
|
|
describe('Item', () => {
|
|
|
|
describe('Component vnItemCard', () => {
|
|
|
|
let $httpBackend;
|
2018-09-14 11:43:51 +00:00
|
|
|
let $stateParams;
|
2018-02-05 15:53:41 +00:00
|
|
|
let controller;
|
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(ngModule('item'));
|
2018-02-05 15:53:41 +00:00
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, _$stateParams_, _$httpBackend_) => {
|
2018-02-05 15:53:41 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2018-09-14 11:43:51 +00:00
|
|
|
$stateParams = {
|
|
|
|
id: 123
|
2018-02-20 13:30:02 +00:00
|
|
|
};
|
2018-09-14 11:43:51 +00:00
|
|
|
controller = $componentController('vnItemCard', {$stateParams});
|
2018-02-05 15:53:41 +00:00
|
|
|
}));
|
|
|
|
|
2018-09-14 11:43:51 +00:00
|
|
|
describe('getCard()', () => {
|
|
|
|
it('should request to set the item into the controller', () => {
|
|
|
|
let response = {id: 123};
|
|
|
|
$httpBackend.when('GET', `/item/api/Items/123/getCard`).respond(response);
|
|
|
|
$httpBackend.expect('GET', `/item/api/Items/123/getCard`);
|
|
|
|
controller.getCard();
|
2018-03-02 09:51:01 +00:00
|
|
|
$httpBackend.flush();
|
2018-09-14 11:43:51 +00:00
|
|
|
|
|
|
|
expect(controller.item).toEqual(response);
|
2018-03-02 09:51:01 +00:00
|
|
|
});
|
|
|
|
});
|
2018-02-05 15:53:41 +00:00
|
|
|
});
|
|
|
|
});
|