|
@@ -126,15 +126,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isUpgradeFailed', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'UPGRADE_FAILED', e: true},
|
|
|
- {workStatus: 'OTHER_STATUS', e: false}
|
|
|
- ]);
|
|
|
-
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isUpgradeFailed')).to.equal(test.e);
|
|
|
+ var tests = ['UPGRADE_FAILED'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
+
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isUpgradeFailed')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -142,15 +142,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isInstallFailed', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'INSTALL_FAILED', e: true},
|
|
|
- {workStatus: 'OTHER_STATUS', e: false}
|
|
|
- ]);
|
|
|
+ var tests = ['INSTALL_FAILED'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isInstallFailed')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isInstallFailed')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -158,16 +158,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isStart', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'STARTED', e: true},
|
|
|
- {workStatus: 'STARTING', e: true},
|
|
|
- {workStatus: 'OTHER_STATUS', e: false}
|
|
|
- ]);
|
|
|
+ var tests = ['STARTED','STARTING'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isStart')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isStart')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -175,15 +174,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isStop', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'INSTALLED', e: true},
|
|
|
- {workStatus: 'OTHER_STATUS', e: false}
|
|
|
- ]);
|
|
|
+ var tests = ['INSTALLED'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isStop')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isStop')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -191,15 +190,31 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isInstalling', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'INSTALLING', e: true},
|
|
|
- {workStatus: 'OTHER_STATUS', e: false}
|
|
|
- ]);
|
|
|
+ var tests = ['INSTALLING'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isInstalling')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isInstalling')).to.equal(e);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#isInit', function() {
|
|
|
+
|
|
|
+ var tests = ['INIT'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
+
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isInit')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -207,18 +222,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#noActionAvailable', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'STARTING', e: 'hidden'},
|
|
|
- {workStatus: 'STOPPING', e: 'hidden'},
|
|
|
- {workStatus: 'UNKNOWN', e: 'hidden'},
|
|
|
- {workStatus: 'DISABLED', e: 'hidden'},
|
|
|
- {workStatus: 'OTHER_STATUS', e: ''}
|
|
|
- ]);
|
|
|
+ var tests = ['STARTING', 'STOPPING', 'UNKNOWN', 'DISABLED'];
|
|
|
+ var testE = 'hidden';
|
|
|
+ var defaultE = '';
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('noActionAvailable')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('noActionAvailable')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -286,15 +298,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isRestartComponentDisabled', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'STARTED', e: false},
|
|
|
- {workStatus: 'OTHER_STATUS', e: true}
|
|
|
- ]);
|
|
|
+ var tests = ['STARTED'];
|
|
|
+ var testE = false;
|
|
|
+ var defaultE = true;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isRestartComponentDisabled')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isRestartComponentDisabled')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -302,18 +314,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isDeleteComponentDisabled', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {workStatus: 'INSTALLED', e: false},
|
|
|
- {workStatus: 'UNKNOWN', e: false},
|
|
|
- {workStatus: 'INSTALL_FAILED', e: false},
|
|
|
- {workStatus: 'UPGRADE_FAILED', e: false},
|
|
|
- {workStatus: 'OTHER_STATUS', e: true}
|
|
|
- ]);
|
|
|
+ var tests = ['INSTALLED', 'UNKNOWN', 'INSTALL_FAILED', 'UPGRADE_FAILED', 'INIT'];
|
|
|
+ var testE = false;
|
|
|
+ var defaultE = true;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', {workStatus: test.workStatus});
|
|
|
- expect(hostComponentView.get('isDeleteComponentDisabled')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isDeleteComponentDisabled')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -424,25 +433,15 @@ describe('App.HostComponentView', function() {
|
|
|
|
|
|
describe('#isInProgress', function() {
|
|
|
|
|
|
- var tests = Em.A([
|
|
|
- {
|
|
|
- workStatus: App.HostComponentStatus.stopping,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- workStatus: App.HostComponentStatus.starting,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- workStatus: 'other_status',
|
|
|
- e: false
|
|
|
- }
|
|
|
- ]);
|
|
|
+ var tests = ['STOPPING', 'STARTING'];
|
|
|
+ var testE = true;
|
|
|
+ var defaultE = false;
|
|
|
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.workStatus, function() {
|
|
|
- hostComponentView.set('content', Em.Object.create({workStatus: test.workStatus}));
|
|
|
- expect(hostComponentView.get('isInProgress')).to.equal(test.e);
|
|
|
+ App.HostComponentStatus.getStatusesList().forEach(function(status) {
|
|
|
+ it(status, function() {
|
|
|
+ hostComponentView.set('content', {workStatus: status});
|
|
|
+ var e = tests.contains(status) ? testE : defaultE;
|
|
|
+ expect(hostComponentView.get('isInProgress')).to.equal(e);
|
|
|
});
|
|
|
});
|
|
|
|