#512 /main-menu/main-menu.js Front unit test
This commit is contained in:
parent
d2eaa62461
commit
2b4959ce36
|
@ -0,0 +1,28 @@
|
|||
import './main-menu.js';
|
||||
|
||||
describe('Component vnMainMenu', () => {
|
||||
let $httpBackend;
|
||||
let controller;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('salix');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => {
|
||||
let modulesFactory = {getModules: () => {}};
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
|
||||
controller = _$componentController_('vnMainMenu', {modulesFactory: modulesFactory});
|
||||
}));
|
||||
|
||||
describe('getCurrentUserName()', () => {
|
||||
it(`should set the user name property in the controller`, () => {
|
||||
$httpBackend.when('GET', `/auth/api/Accounts/getCurrentUserName`).respond('Batman');
|
||||
$httpBackend.expect('GET', `/auth/api/Accounts/getCurrentUserName`);
|
||||
controller.getCurrentUserName();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$.currentUserName).toEqual('Batman');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue