28 lines
807 B
JavaScript
28 lines
807 B
JavaScript
import './index';
|
|
|
|
describe('component vnUserCard', () => {
|
|
let controller;
|
|
let $httpBackend;
|
|
|
|
beforeEach(ngModule('account'));
|
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
$httpBackend = _$httpBackend_;
|
|
controller = $componentController('vnUserCard', {$element: null});
|
|
}));
|
|
|
|
describe('reload()', () => {
|
|
it('should reload the controller data', () => {
|
|
controller.$params.id = 1;
|
|
|
|
$httpBackend.expectGET('Accounts/1').respond('foo');
|
|
$httpBackend.expectGET('UserAccounts/1/exists').respond({exists: true});
|
|
controller.reload();
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.user).toBe('foo');
|
|
expect(controller.hasAccount).toBeTruthy();
|
|
});
|
|
});
|
|
});
|