UNPKG

caesar-cipher-amine

Version:
49 lines (45 loc) 1.36 kB
var should = require('should'); var caesar = require('../bin/caesarMethode.js'); describe('caesar' , function () { it("should fail if the -d argument is not a number",function(done) { try { caesar("Hello" , "aa"); } catch(e) { e.toString().should.containDeep('The value of -d option must be an number') return done(); } done(new Error("Should not be working")) }); it("should fail with an undifined text argument", function(done) { try{ var text; caesar( text , 2); } catch(e){ e.toString().should.containDeep("arguments must be defined"); return done(); } done(new Error("Should not be working")); }); it ("should work. test with 'abc def' and right shift of 2" , function(done) { var result = caesar("abd def" , 2); should.deepEqual(result ,'cdf fgh'); done(); }); it("should work. test with 'abc 2' and rightshift of 2" , function(done) { var result = caesar("abc 2" , 2); should.deepEqual(result,"cde 2"); done(); }); it ("should work. Test the left shift with -2" , function (done) { var result = caesar("abc" , -2); should.deepEqual(result, "yza"); done(); }); it ("should work. Test the right shift with 30. Equivalent to 4",function(done) { var result = caesar("abc", 30); should.deepEqual(result , "efg" ); done(); }); });