diff --git a/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.js b/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.js index ca6d11e..0afa22b 100644 --- a/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.js +++ b/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.js @@ -78,7 +78,7 @@ export const calculateProtectionWeakness = (threatScore, Q3, Q4) => { * @param {string} protectionWeakness The protection weakness (see calculateProtectionWeakness) * @returns {string} The attack efficiency */ -const calculateAttackEfficiency = (protectionWeakness) => { +export const calculateAttackEfficiency = (protectionWeakness) => { return protectionWeakness; }; diff --git a/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.test.js b/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.test.js index d08ece9..26e20fe 100644 --- a/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.test.js +++ b/src/features/BinaryRiskMatrix/BinaryRiskMatrixLogic/calculateLikelihood/calculateLikelihood.test.js @@ -1,6 +1,7 @@ import { calculateThreatScope, calculateProtectionWeakness, + calculateAttackEfficiency, } from "./calculateLikelihood"; describe("testing the calculateThreatScope function", () => { @@ -154,3 +155,23 @@ describe("testing the calculateProtectionWeakness function", () => { ); }); }); + +describe("testing the calculateAttackEfficiency function", () => { + it("should return High if the protectionWeakness is High", () => { + const expectValue = "High"; + const protectionWeakness = "High"; + expect(calculateAttackEfficiency(protectionWeakness)).toBe(expectValue); + }); + + it("should return Medium if the protectionWeakness is Medium", () => { + const expectValue = "Medium"; + const protectionWeakness = "Medium"; + expect(calculateAttackEfficiency(protectionWeakness)).toBe(expectValue); + }); + + it("should return Low if the protectionWeakness is Low", () => { + const expectValue = "Low"; + const protectionWeakness = "Low"; + expect(calculateAttackEfficiency(protectionWeakness)).toBe(expectValue); + }); +});