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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy