-
-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathcrypto-square.test.ts
47 lines (39 loc) · 1.4 KB
/
crypto-square.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Crypto } from './crypto-square'
describe('Crypto', () => {
it('empty plaintext results in an empty ciphertext', () => {
const crypto = new Crypto('')
expect(crypto.ciphertext).toEqual('')
})
xit('normalization results in empty plaintext', () => {
const crypto = new Crypto('... --- ...')
expect(crypto.ciphertext).toEqual('')
})
xit('Lowercase', () => {
const crypto = new Crypto('A')
expect(crypto.ciphertext).toEqual('a')
})
xit('Remove spaces', () => {
const crypto = new Crypto(' b ')
expect(crypto.ciphertext).toEqual('b')
})
xit('Remove punctuation', () => {
const crypto = new Crypto('@1,%!')
expect(crypto.ciphertext).toEqual('1')
})
xit('9 character plaintext results in 3 chunks of 3 characters', () => {
const crypto = new Crypto('This is fun!')
expect(crypto.ciphertext).toEqual('tsf hiu isn')
})
xit('8 character plaintext results in 3 chunks, the last one with a trailing space', () => {
const crypto = new Crypto('Chill out.')
expect(crypto.ciphertext).toEqual('clu hlt io ')
})
xit('54 character plaintext results in 7 chunks, the last two with trailing spaces', () => {
const crypto = new Crypto(
'If man was meant to stay on the ground, god would have given us roots.'
)
expect(crypto.ciphertext).toEqual(
'imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau '
)
})
})