mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Merge pull request #397 from jakemcdermott/unit-linting
additional test de-linting
This commit is contained in:
commit
d4af743805
@ -3,7 +3,6 @@ describe('Components | Layout', () => {
|
||||
let $rootScope;
|
||||
let element;
|
||||
let scope;
|
||||
let i18n;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('gettext');
|
||||
@ -26,19 +25,19 @@ describe('Components | Layout', () => {
|
||||
describe('AtLayoutController', () => {
|
||||
let controller;
|
||||
|
||||
beforeEach(()=> {
|
||||
beforeEach(() => {
|
||||
controller = element.controller('atLayout');
|
||||
});
|
||||
|
||||
it('$scope.$on($stateChangeSuccess) should assign toState name to currentState', () => {
|
||||
let next = {'name': 'dashboard'};
|
||||
const next = { name: 'dashboard' };
|
||||
$rootScope.$broadcast('$stateChangeSuccess', next);
|
||||
expect(controller.currentState).toBe('dashboard');
|
||||
});
|
||||
|
||||
describe('$root.current_user watcher should assign value to ', () => {
|
||||
beforeEach(() => {
|
||||
let val = {
|
||||
const val = {
|
||||
username: 'admin',
|
||||
id: 1
|
||||
};
|
||||
@ -89,11 +88,10 @@ describe('Components | Layout', () => {
|
||||
expect(controller.currentUserId).toBeTruthy();
|
||||
expect(controller.currentUserId).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('$root.socketStatus watcher should assign newStatus to', () => {
|
||||
let statuses = ['connecting', 'error', 'ok'];
|
||||
const statuses = ['connecting', 'error', 'ok'];
|
||||
|
||||
it('socketState', () => {
|
||||
_.forEach(statuses, (status) => {
|
||||
@ -128,7 +126,7 @@ describe('Components | Layout', () => {
|
||||
describe('getString()', () => {
|
||||
it('calls ComponentsStrings get() method', angular.mock.inject((_ComponentsStrings_) => {
|
||||
spyOn(_ComponentsStrings_, 'get');
|
||||
controller.getString('VIEW_DOCS')
|
||||
controller.getString('VIEW_DOCS');
|
||||
expect(_ComponentsStrings_.get).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
@ -137,7 +135,7 @@ describe('Components | Layout', () => {
|
||||
});
|
||||
|
||||
it('should return layout string', () => {
|
||||
let layoutStrings = {
|
||||
const layoutStrings = {
|
||||
CURRENT_USER_LABEL: 'Logged in as',
|
||||
VIEW_DOCS: 'View Documentation',
|
||||
LOGOUT: 'Logout',
|
||||
@ -149,8 +147,8 @@ describe('Components | Layout', () => {
|
||||
});
|
||||
|
||||
it('should return default string', () => {
|
||||
let defaultStrings = {
|
||||
BRAND_NAME: "AWX"
|
||||
const defaultStrings = {
|
||||
BRAND_NAME: 'AWX'
|
||||
};
|
||||
|
||||
_.forEach(defaultStrings, (value, key) => {
|
||||
@ -159,4 +157,4 @@ describe('Components | Layout', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -8,8 +8,8 @@ describe('Components | Side Nav Item', () => {
|
||||
angular.mock.module('gettext');
|
||||
angular.mock.module('I18N');
|
||||
angular.mock.module('ui.router');
|
||||
angular.mock.module('at.lib.services')
|
||||
angular.mock.module('at.lib.components')
|
||||
angular.mock.module('at.lib.services');
|
||||
angular.mock.module('at.lib.components');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$compile_, _$rootScope_) => {
|
||||
@ -24,7 +24,6 @@ describe('Components | Side Nav Item', () => {
|
||||
}));
|
||||
|
||||
describe('Side Nav Item Controller', () => {
|
||||
let LayoutCtrl;
|
||||
let SideNavItem;
|
||||
let SideNavItemCtrl;
|
||||
|
||||
@ -34,12 +33,12 @@ describe('Components | Side Nav Item', () => {
|
||||
});
|
||||
|
||||
it('layoutVm.currentState watcher should assign isRoute', () => {
|
||||
let current = {'name': 'dashboard'};
|
||||
let current = { name: 'dashboard' };
|
||||
$rootScope.$broadcast('$stateChangeSuccess', current);
|
||||
scope.$digest();
|
||||
expect(SideNavItemCtrl.isRoute).toBe(true);
|
||||
|
||||
current = {'name': 'inventories'};
|
||||
current = { name: 'inventories' };
|
||||
$rootScope.$broadcast('$stateChangeSuccess', current);
|
||||
scope.$digest();
|
||||
expect(SideNavItemCtrl.isRoute).toBe(false);
|
||||
@ -3,7 +3,7 @@ describe('Components | Side Nav', () => {
|
||||
let $rootScope;
|
||||
let element;
|
||||
let scope;
|
||||
let windowMock = {
|
||||
const windowMock = {
|
||||
innerWidth: 500
|
||||
};
|
||||
|
||||
@ -11,7 +11,7 @@ describe('Components | Side Nav', () => {
|
||||
angular.mock.module('gettext');
|
||||
angular.mock.module('I18N');
|
||||
angular.mock.module('ui.router');
|
||||
angular.mock.module('at.lib.services')
|
||||
angular.mock.module('at.lib.services');
|
||||
angular.mock.module('at.lib.components', ($provide) => {
|
||||
$provide.value('$window', windowMock);
|
||||
});
|
||||
@ -22,7 +22,7 @@ describe('Components | Side Nav', () => {
|
||||
$rootScope = _$rootScope_;
|
||||
scope = $rootScope.$new();
|
||||
|
||||
element = angular.element("<at-layout><at-side-nav></at-side-nav><at-layout>");
|
||||
element = angular.element('<at-layout><at-side-nav></at-side-nav><at-layout>');
|
||||
element = $compile(element)(scope);
|
||||
scope.$digest();
|
||||
}));
|
||||
@ -59,8 +59,8 @@ describe('Components | Side Nav', () => {
|
||||
it('isExpanded should be false after state change event', () => {
|
||||
sideNavCtrl.isExpanded = true;
|
||||
|
||||
let current = {
|
||||
'name': 'dashboard'
|
||||
const current = {
|
||||
name: 'dashboard'
|
||||
};
|
||||
$rootScope.$broadcast('$stateChangeSuccess', current);
|
||||
scope.$digest();
|
||||
Loading…
x
Reference in New Issue
Block a user