From 784f86bd5b66df9ab76d315628df122634813042 Mon Sep 17 00:00:00 2001 From: awdesh Date: Sat, 2 Jan 2016 15:49:20 -0600 Subject: [PATCH] adding more tests --- README.md | 3 ++- index.js | 2 +- test/test.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5107ff9..7532ddf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Caesar-s-Cipher [![Build Status](https://travis-ci.org/Awdesh/Caesar-s-Cipher.svg?branch=master)](https://travis-ci.org/Awdesh/Caesar-s-Cipher) [![Coverage Status](https://coveralls.io/repos/Awdesh/Caesar-s-Cipher/badge.svg?branch=master&service=github)](https://coveralls.io/github/Awdesh/Caesar-s-Cipher?branch=master) -============================================================== + + Node module to encode string. A small library that encodes string by shifting characters in a string. ## Installation diff --git a/index.js b/index.js index dc4c228..d272e2e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = function (encodedStr) { - // body... + encodedStr = encodedStr.toUpperCase(); var codeArr = encodedStr.split(""); // String to Array var len = codeArr.length; var decodedArr = []; // Your Result goes here diff --git a/test/test.js b/test/test.js index dc56a60..4765d11 100644 --- a/test/test.js +++ b/test/test.js @@ -8,4 +8,16 @@ describe('#cipher', function () { var result = cipher("FREE"); expect(result).to.equal('SERR'); }); + it('should encode lowercase words', function() { + var result = cipher("free"); + expect(result).to.equal('SERR'); + }); + it('should encode lowercase words', function() { + var result = cipher("SERR-PIZZA!"); + expect(result).to.equal('FREE-CVMMN!'); + }); + it('should encode lowercase words', function() { + var result = cipher("free cvmmn!"); + expect(result).to.equal('SERR PIZZA!'); + }); }); \ No newline at end of file