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

+14
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)