Last active
August 6, 2021 16:05
-
-
Save louislatreille/349699047a6b4b7dd4e2eddd64283634 to your computer and use it in GitHub Desktop.
(Article - You should aim to forget how your code works)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("GIVEN a call to decodeMorse", () => { | |
[... additional tests to cover non-edge cases ...] | |
it('THEN it decodes the special SOS code', () => { | |
Test.assertEquals(decodeMorse('...---...'), 'SOS'); | |
}); | |
it('THEN it decodes the special = code', () => { | |
Test.assertEquals(decodeMorse('-...-'), '='); | |
}); | |
describe("AND the input contains trailing spaces", () => { | |
it('THEN the trailing spaces are removed and ignored in the output', () => { | |
Test.assertEquals(decodeMorse(' .... . .-.. .-.. --- -- . -.. .. ..- -- '), 'HELLO MEDIUM'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment