2020-03-09 08:00:03 +00:00
|
|
|
import './index';
|
|
|
|
|
2024-01-31 12:16:56 +00:00
|
|
|
describe('component vnRoleDescriptor', () => {
|
2020-03-09 08:00:03 +00:00
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
|
|
|
|
|
|
|
let role = {id: 1, name: 'foo'};
|
|
|
|
|
|
|
|
beforeEach(ngModule('account'));
|
|
|
|
|
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
controller = $componentController('vnRoleDescriptor', {$element: null}, {role});
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe('onDelete()', () => {
|
|
|
|
it('should delete entity and go to index', () => {
|
|
|
|
controller.$state.go = jest.fn();
|
|
|
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
|
|
|
2023-12-11 11:40:16 +00:00
|
|
|
$httpBackend.expectDELETE('VnRoles/1').respond();
|
2020-03-09 08:00:03 +00:00
|
|
|
controller.onDelete();
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.$state.go).toHaveBeenCalledWith('account.role');
|
|
|
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|