From c8a6fcae3ff322dd035163fc0ba87b6b30384c53 Mon Sep 17 00:00:00 2001 From: AlfonMnz Date: Sun, 12 Jun 2022 04:40:33 +0200 Subject: [PATCH] Add More options to call 619 ("Booyakah") Number and Unit Test --- index.js | 2 +- index.test.js | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 5 ++++- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 index.test.js diff --git a/index.js b/index.js index e9596f9..97f43ae 100644 --- a/index.js +++ b/index.js @@ -619,7 +619,7 @@ function isEven(number) { else if(number === 616 || number === "616" || number === "six hundred sixteen" || number === "Six Hundred Sixteen" || number === "SIX HUNDRED SIXTEEN") return true; else if(number === 617 || number === "617" || number === "six hundred seventeen" || number === "Six Hundred Seventeen" || number === "SIX HUNDRED SEVENTEEN") return false; else if(number === 618 || number === "618" || number === "six hundred eighteen" || number === "Six Hundred Eighteen" || number === "SIX HUNDRED EIGHTEEN") return true; - else if(number === 619 || number === "619" || number === "six hundred nineteen" || number === "Six Hundred Nineteen" || number === "SIX HUNDRED NINETEEN") return false; + else if(number === 619 || number === "619" || number === "six hundred nineteen" || number === "Six Hundred Nineteen" || number === "SIX HUNDRED NINETEEN" || number === 'SixOneNine' || number === 'sixonenine' || number === 'SIXONENINE' || number === 'Six One Nine' || number === 'six one nine' || number === 'SIX ONE NINE' ) return false; else if(number === 620 || number === "620" || number === "six hundred twenty" || number === "Six Hundred Twenty" || number === "SIX HUNDRED TWENTY") return true; else if(number === 621 || number === "621" || number === "six hundred twenty-one" || number === "Six Hundred Twenty-One" || number === "SIX HUNDRED TWENTY-ONE") return false; else if(number === 622 || number === "622" || number === "six hundred twenty-two" || number === "Six Hundred Twenty-Two" || number === "SIX HUNDRED TWENTY-TWO") return true; diff --git a/index.test.js b/index.test.js new file mode 100644 index 0000000..fa0fec0 --- /dev/null +++ b/index.test.js @@ -0,0 +1,62 @@ +var iseven = require('./index'); +describe('Is Even test', () => { + test('is 1 even expect false', ()=> { + expect(iseven(1)==false); + }); + + test('is \"1\" even expect false', ()=> { + expect(iseven("1")==false); + }); + + test('is \"one\" even expect false', ()=> { + expect(iseven("one")==false); + }); + + test('is \"One\" even expect false', ()=> { + expect(iseven("One")==false); + }); + + test('is \"ONE\" even expect false', ()=> { + expect(iseven("ONE")==false); + }); + test('is 619 even expect false', ()=> { + expect(iseven(619)==false); + }); + + test('is \"619\" even expect false', ()=> { + expect(iseven("619")==false); + }); + + test('is \"six hundred nineteen\" even expect false', ()=> { + expect(iseven("six hundred nineteen")==false); + }); + + test('is \"Six Hundred Nineteen\" even expect false', ()=> { + expect(iseven("Six Hundred Nineteen")==false); + }); + test('is \"SIX HUNDRED NINETEEN\" even expect false', ()=> { + expect(iseven("SIX HUNDRED NINETEEN")==false); + }); + test('is \"SixOneNine\" even expect false', ()=> { + expect(iseven("SixOneNine")==false); + }); + test('is \"sixonenine\" even expect false', ()=> { + expect(iseven("sixonenine")==false); + }); + test('is \"SIXONENINE\" even expect false', ()=> { + expect(iseven("SIXONENINE")==false); + }); + test('is \"Six One Nine\" even expect false', ()=> { + expect(iseven("Six One Nine")==false); + }); + test('is \"six one nine\" even expect false', ()=> { + expect(iseven("six one nine")==false); + }); + test('is \"SIX ONE NINE\" even expect false', ()=> { + expect(iseven("SIX ONE NINE")==false); + }); + + + + +}); diff --git a/package.json b/package.json index 5fe837d..357f999 100644 --- a/package.json +++ b/package.json @@ -18,5 +18,8 @@ "bugs": { "url": "https://github.com/samuelmarina/is-even/issues" }, - "homepage": "https://github.com/samuelmarina/is-even#readme" + "homepage": "https://github.com/samuelmarina/is-even#readme", + "devDependencies": { + "jest": "^28.1.1" + } }