From 7bba11460d704311e0728c3531f7675db6577fb5 Mon Sep 17 00:00:00 2001 From: Olivier Bellemare Date: Sun, 26 Aug 2018 12:01:35 -0400 Subject: [PATCH] Add tests for modified code --- test/baseAPI.spec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/baseAPI.spec.js b/test/baseAPI.spec.js index 4fdc506..a0f817b 100644 --- a/test/baseAPI.spec.js +++ b/test/baseAPI.spec.js @@ -210,6 +210,28 @@ }); }); + describe("#clearSCORMError", function() { + var anyLastErrorCode = 101; + + beforeEach(function() { + api.lastErrorCode = anyLastErrorCode; + }); + + context("given a success", function() { + it("should clear the last SCORM error", function() { + api.clearSCORMError(constants.SCORM_TRUE); + expect(api.lastErrorCode).to.equal(0); + }); + }); + + context("given a failure", function() { + it("should not clear the last SCORM error", function() { + api.clearSCORMError(constants.SCORM_FALSE); + expect(api.lastErrorCode).to.equal(anyLastErrorCode); + }); + }); + }); + describe("#getLmsErrorMessageDetails", function() { it("should return no error", function() { expect(api.getLmsErrorMessageDetails()).to.equal("No error");