34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Item', () => {
|
|
describe('Component vnItemCard', () => {
|
|
let $httpBackend;
|
|
let $stateParams;
|
|
let controller;
|
|
|
|
beforeEach(angular.mock.module('item', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
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);
|
|
});
|
|
});
|
|
});
|
|
});
|