Content-Length: 280326 | pFad | http://github.com/TheAlgorithms/JavaScript/commit/25add224447e68fe534b44298ebb5284ceb28d0f

B6 "test: add missing coverage for Substitution Cipher decryption edge c… · TheAlgorithms/JavaScript@25add22 · GitHub
Skip to content

Commit 25add22

Browse files
"test: add missing coverage for Substitution Cipher decryption edge cases"
1 parent b9432a0 commit 25add22

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Ciphers/test/SubstitutionCipher.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,18 @@ describe('Substitution Cipher', () => {
2727
RangeError
2828
)
2929
})
30+
it('encrypts using default key if none provided', () => {
31+
const encrypted = substitutionCipherEncryption('HELLO WORLD')
32+
expect(encrypted).toBe('ITSSG VGKSR')
33+
})
34+
35+
it('decrypts using default key if none provided', () => {
36+
const decrypted = substitutionCipherDecryption('ITSSG VGKSR')
37+
expect(decrypted).toBe('HELLO WORLD')
38+
})
39+
40+
it('throws error for invalid key in decryption', () => {
41+
expect(() => substitutionCipherDecryption('HELLO', 'BADKEY')).toThrow(RangeError)
42+
})
43+
3044
})

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/TheAlgorithms/JavaScript/commit/25add224447e68fe534b44298ebb5284ceb28d0f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy