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

* [feat] New algorithm * [test] Add new test for ParityOutlier.js * [fix] Reset indentation * [fix] Reset indentation * [fix] Style changes * fix: improve code efficiency and a glitch * test: adds a new possible test case * fix: style fix * fix: delete redundant comments and else statements * [fix] style fix * feat: New algorithm * fix: fixed custom code symbols * test: add test for MorseCode * test: add case with custom code symbols * delete files from main branch * fix: style fix * fix: style fix * fix: delete unnecessary quotes
17 lines
697 B
JavaScript
17 lines
697 B
JavaScript
import { morse } from '../MorseCode'
|
|
|
|
describe('Testing morse function', () => {
|
|
it('should return an enciphered string with a given input string', () => {
|
|
expect(morse('Hello World!')).toBe('**** * *-** *-** --- *-- --- *-* *-** -** -*-*--')
|
|
expect(morse('1+1=2')).toBe('*---- *-*-* *---- -***- **---')
|
|
})
|
|
|
|
it('should leave symbols that does not have its corresponding morse representation', () => {
|
|
expect(morse('© 2023 GitHub, Inc.')).toBe('© **--- ----- **--- ***-- --* ** - **** **- -*** --**-- ** -* -*-* *-*-*-')
|
|
})
|
|
|
|
it('should be able to accept custom morse code symbols', () => {
|
|
expect(morse('Nodejs', '.', '|')).toBe('|. ||| |.. . .||| ...')
|
|
})
|
|
})
|