2022-03-27 23:15:14 +06:00
|
|
|
import Atbash from '../Atbash'
|
|
|
|
|
|
|
|
|
|
describe('Testing Atbash function', () => {
|
2022-03-28 12:20:16 +07:00
|
|
|
it('Test - 1, passing a non-string as an argument', () => {
|
2022-03-27 23:15:14 +06:00
|
|
|
expect(() => Atbash(0x345)).toThrow()
|
|
|
|
|
expect(() => Atbash(123)).toThrow()
|
|
|
|
|
expect(() => Atbash(123n)).toThrow()
|
|
|
|
|
expect(() => Atbash(false)).toThrow()
|
|
|
|
|
expect(() => Atbash({})).toThrow()
|
|
|
|
|
expect(() => Atbash([])).toThrow()
|
|
|
|
|
})
|
|
|
|
|
|
2022-03-28 12:20:16 +07:00
|
|
|
it('Test - 2, passing a string as an argument', () => {
|
|
|
|
|
const clearText = 'The quick brown fox jumps over the lazy dog'
|
|
|
|
|
const cryptText = Atbash(clearText)
|
|
|
|
|
expect(Atbash(cryptText)).toBe(clearText)
|
2022-03-27 23:15:14 +06:00
|
|
|
})
|
|
|
|
|
})
|