Merge "Add a check for nonexistent capabilities"
This commit is contained in:
commit
cecf615eb1
@ -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) {
|
||||
|
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user