32 lines
1008 B
JavaScript
32 lines
1008 B
JavaScript
import './index.js';
|
|
|
|
describe('Item', () => {
|
|
describe('Component vnItemCard', () => {
|
|
let $httpBackend;
|
|
let $stateParams;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('item'));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, _$stateParams_, _$httpBackend_) => {
|
|
$httpBackend = _$httpBackend_;
|
|
$stateParams = {
|
|
id: 123
|
|
};
|
|
controller = $componentController('vnItemCard', {$stateParams});
|
|
}));
|
|
|
|
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();
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.item).toEqual(response);
|
|
});
|
|
});
|
|
});
|
|
});
|