mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-20 18:43:43 +08:00

* chore: added helper variable * feat: added new rotation option * Revert "chore: added helper variable" This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.
17 lines
799 B
JavaScript
17 lines
799 B
JavaScript
import caesarsCipher from '../CaesarsCipher'
|
|
|
|
describe('Testing the caesarsCipher function', () => {
|
|
it('Test - 1, Testing for invalid types', () => {
|
|
expect(() => caesarsCipher(false, 3)).toThrow()
|
|
expect(() => caesarsCipher('false', -1)).toThrow()
|
|
expect(() => caesarsCipher('true', null)).toThrow()
|
|
})
|
|
|
|
it('Test - 2, Testing for valid string and rotation', () => {
|
|
expect(caesarsCipher('middle-Outz', 2)).toBe('okffng-Qwvb')
|
|
expect(caesarsCipher('abcdefghijklmnopqrstuvwxyz', 3)).toBe('defghijklmnopqrstuvwxyzabc')
|
|
expect(caesarsCipher('Always-Look-on-the-Bright-Side-of-Life', 5)).toBe('Fqbfdx-Qttp-ts-ymj-Gwnlmy-Xnij-tk-Qnkj')
|
|
expect(caesarsCipher('THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG', 23)).toBe('QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD')
|
|
})
|
|
})
|