Author: ygrego Date: 2015-02-16 17:18:46 +0000 (Mon, 16 Feb 2015) New Revision: 811 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/811 Log: This class contain assertion method for tests methods. Added: oipf/js/test/TestCase.js Added: oipf/js/test/TestCase.js =================================================================== --- oipf/js/test/TestCase.js (rev 0) +++ oipf/js/test/TestCase.js 2015-02-16 17:18:46 UTC (rev 811) @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +var TestCase = Class.extend({ + + init: function() { + }, + + assertNotUndefined : function(elmt) { + + try{ + if (elmt !== undefined) { + console.log("[INFO] Element are not undefined."); + } else { + throw new Error("The element is undefined."); + } + } catch (e) { + console.log(e); + + } + + }, + + assertEquals: function(elmt1, elmt2) { + + try{ + if (elmt1 === elmt2) { + console.log("[INFO] Both elements are equals."); + } else { + throw new Error("Both elements are not equals."); + } + } catch (e) { + console.log(e); + + } + }, + + assertNotNull: function(elmt) { + + try{ + if (elmt !== null) { + console.log("[INFO] Element are not null."); + } else { + throw new Error("The element is null."); + } + } catch (e) { + console.log(e); + + } + + } + +}); +
participants (1)
-
ygregoï¼ users.nuiton.org