mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
merge: Improved ciphers (#954)
* feat: imporved algorithm via replace method * test: added two test cases
This commit is contained in:
17
Ciphers/test/Atbash.test.js
Normal file
17
Ciphers/test/Atbash.test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Atbash from '../Atbash'
|
||||
|
||||
describe('Testing Atbash function', () => {
|
||||
it('Test - 1, passing the non-string as an argument', () => {
|
||||
expect(() => Atbash(0x345)).toThrow()
|
||||
expect(() => Atbash(123)).toThrow()
|
||||
expect(() => Atbash(123n)).toThrow()
|
||||
expect(() => Atbash(false)).toThrow()
|
||||
expect(() => Atbash({})).toThrow()
|
||||
expect(() => Atbash([])).toThrow()
|
||||
})
|
||||
|
||||
it('Test - 2, passing all alphabets', () => {
|
||||
expect(Atbash('HELLO WORLD')).toBe('SVOOL DLIOW')
|
||||
expect(Atbash('The quick brown fox jumps over the lazy dog')).toBe('Gsv jfrxp yildm ulc qfnkh levi gsv ozab wlt')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user