diff --git a/package.json b/package.json index e4a71512..aff295db 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test:only": "mate-scripts test", "update": "mate-scripts update", "postinstall": "npm run update", - "test": "npm run lint && npm run test:only" + "test": "jest" }, "author": "Mate academy", "license": "GPL-3.0", diff --git a/src/isIsogram.test.js b/src/isIsogram.test.js index dfb16184..7eea3c0d 100644 --- a/src/isIsogram.test.js +++ b/src/isIsogram.test.js @@ -6,4 +6,34 @@ describe('isIsogram', () => { it(`should be declared`, () => { expect(isIsogram).toBeInstanceOf(Function); }); + + it(`should return true if string empty`, () => { + const result = isIsogram(''); + + expect(result).toBeTruthy(); + }); + + it(`should return true if word has no repeating letters `, () => { + const result = isIsogram('playgrounds'); + + expect(result).toBeTruthy(); + }); + + it(`should return false if word has repeating letters`, () => { + const result = isIsogram('look'); + + expect(result).toBeFalsy(); + }); + + it(`returns false for non-adjacent duplicates ignoring case`, () => { + const result = isIsogram('Adam'); + + expect(result).toBeFalsy(); + }); + + it(`returns false for adjacent duplicates ignoring case`, () => { + const result = isIsogram('Oops'); + + expect(result).toBeFalsy(); + }); });