|
1 | 1 | import {expect, test} from '@oclif/test' |
2 | | -// @ts-ignore |
3 | | -import jest from 'jest-mock' |
4 | | - |
5 | 2 | import Crypto from '../../src/commands/crypto' |
6 | 3 |
|
7 | 4 | describe('crypto', () => { |
8 | | - // // TODO: its not possible to predict the encription for a message so we can't write this,however decription is predictible |
9 | | - // test |
10 | | - // .stdout() |
11 | | - // .command(['crypto', '-e', 'aes', '-s', 'Message', '-k', 'Secret Passphrase']) |
12 | | - // .it('runs hello', ctx => { |
13 | | - // expect(ctx.stdout).to.contain('73e54154a15d1beeb509d9e12f1e462a0') |
14 | | - // }) |
15 | | - // |
16 | 5 |
|
17 | 6 | test |
18 | 7 | .stdout() |
@@ -110,4 +99,53 @@ describe('crypto', () => { |
110 | 99 | expect(ctx.stdout).to.contain('Neither encryption or decryption methods passed') |
111 | 100 | }) |
112 | 101 |
|
| 102 | + |
| 103 | + test |
| 104 | + .stdout() |
| 105 | + .it('AES encryption and decryption Integration Test', async(ctx) => { |
| 106 | + let encrypt = await Crypto.run(['crypto', '-e', 'aes', '-s', 'Message', '-k', 'secret']); |
| 107 | + let decrypt = await Crypto.run(['crypto', '-d', 'aes', '-s', encrypt, '-k', 'secret']); |
| 108 | + expect(decrypt).to.contain('Message'); |
| 109 | + }); |
| 110 | + |
| 111 | + test |
| 112 | + .stdout() |
| 113 | + .it('DES encryption and decryption Integration Test', async(ctx) => { |
| 114 | + let encrypt = await Crypto.run(['crypto', '-e', 'DES', '-s', 'Message', '-k', 'secret']); |
| 115 | + let decrypt = await Crypto.run(['crypto', '-d', 'DES', '-s', encrypt, '-k', 'secret']); |
| 116 | + expect(decrypt).to.contain('Message'); |
| 117 | + }); |
| 118 | + |
| 119 | + test |
| 120 | + .stdout() |
| 121 | + .it('3DES encryption and decryption Integration Test', async(ctx) => { |
| 122 | + let encrypt = await Crypto.run(['crypto', '-e', '3DES', '-s', 'Message', '-k', 'secret']); |
| 123 | + let decrypt = await Crypto.run(['crypto', '-d', '3DES', '-s', encrypt, '-k', 'secret']); |
| 124 | + expect(decrypt).to.contain('Message'); |
| 125 | + }); |
| 126 | + |
| 127 | + test |
| 128 | + .stdout() |
| 129 | + .it('Rabbit encryption and decryption Integration Test', async(ctx) => { |
| 130 | + let encrypt = await Crypto.run(['crypto', '-e', 'Rabbit', '-s', 'Message', '-k', 'secret']); |
| 131 | + let decrypt = await Crypto.run(['crypto', '-d', 'Rabbit', '-s', encrypt, '-k', 'secret']); |
| 132 | + expect(decrypt).to.contain('Message'); |
| 133 | + }); |
| 134 | + |
| 135 | + test |
| 136 | + .stdout() |
| 137 | + .it('RC4 encryption and decryption Integration Test', async(ctx) => { |
| 138 | + let encrypt = await Crypto.run(['crypto', '-e', 'RC4', '-s', 'Message', '-k', 'secret']); |
| 139 | + let decrypt = await Crypto.run(['crypto', '-d', 'RC4', '-s', encrypt, '-k', 'secret']); |
| 140 | + expect(decrypt).to.contain('Message'); |
| 141 | + }); |
| 142 | + |
| 143 | + test |
| 144 | + .stdout() |
| 145 | + .it('RC4Drop encryption and decryption Integration Test', async(ctx) => { |
| 146 | + let encrypt = await Crypto.run(['crypto', '-e', 'RC4Drop', '-s', 'Message', '-k', 'secret']); |
| 147 | + let decrypt = await Crypto.run(['crypto', '-d', 'RC4Drop', '-s', encrypt, '-k', 'secret']); |
| 148 | + expect(decrypt).to.contain('Message'); |
| 149 | + }); |
| 150 | + |
113 | 151 | }) |
0 commit comments