2020-03-09 08:00:03 +00:00
|
|
|
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;
|
|
|
|
|
2023-05-23 07:12:27 +00:00
|
|
|
$httpBackend.expectGET('VnUsers/preview').respond('foo');
|
2023-01-31 13:57:24 +00:00
|
|
|
$httpBackend.expectGET('Accounts/1/exists').respond({exists: true});
|
2020-03-09 08:00:03 +00:00
|
|
|
controller.reload();
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
2023-05-23 07:12:27 +00:00
|
|
|
expect(controller.user).toBe('f');
|
2020-03-09 08:00:03 +00:00
|
|
|
expect(controller.hasAccount).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|