Merge "Add a check for nonexistent capabilities"

This commit is contained in:
Jenkins 2017-01-31 10:15:20 +00:00 committed by Gerrit Code Review
commit cecf615eb1
2 changed files with 20 additions and 0 deletions

View File

@ -348,6 +348,13 @@
'passedFlagged': [],
'notPassedFlagged': []
};
// For cases where a capability listed in components is not
// in the capabilities object.
if (!(capId in ctrl.guidelineData.capabilities)) {
return cap;
}
// Loop through each test belonging to the capability.
angular.forEach(ctrl.guidelineData.capabilities[capId].tests,
function (details, testId) {

View File

@ -554,6 +554,19 @@ describe('Refstack controllers', function () {
expect(ctrl.caps).toEqual(expectedCapsObject);
expect(ctrl.requiredPassPercent).toEqual(75);
expect(ctrl.nonFlagPassCount).toEqual(2);
// Test case where a component capability isn't listed in
// the capabilities object.
ctrl.guidelineData.components.compute.removed = ['fake_cap'];
ctrl.buildCapabilitiesObject();
expectedCapsObject.removed.caps = [{
'id': 'fake_cap',
'passedTests': [],
'notPassedTests': [],
'passedFlagged': [],
'notPassedFlagged': []
}];
expect(ctrl.caps).toEqual(expectedCapsObject);
});
it('should have a method to determine if a test is flagged',