diff options
author | Valentin Popov <info@valentineus.link> | 2017-10-09 22:47:44 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-10-09 22:47:44 +0300 |
commit | 1b31b0beec9d3011c444c70ec11f4da134570cb0 (patch) | |
tree | dadba90ae9381d494b725ebaaa486ac2c2fdd0b6 /src/test.js | |
parent | 38d1a0eab11062da2d900d8d0fac787688d359ea (diff) | |
download | iii-client-1b31b0beec9d3011c444c70ec11f4da134570cb0.tar.xz iii-client-1b31b0beec9d3011c444c70ec11f4da134570cb0.zip |
General code refactoring
Diffstat (limited to 'src/test.js')
-rw-r--r-- | src/test.js | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/src/test.js b/src/test.js index 1c34e5f..56fd03e 100644 --- a/src/test.js +++ b/src/test.js @@ -2,6 +2,7 @@ import { assert } from 'chai'; import generator from 'uuid'; import { + isVerification, decryptJSON, connect, decrypt, @@ -14,51 +15,36 @@ describe('iii-client:', () => { var text = 'Hello, World!'; var data = JSON.stringify({ text }); - it('encrypt():', () => { + it('isVerification()', () => { + assert.isFalse(isVerification(text)); + assert.isTrue(isVerification(uuid)); + }); + + it('encrypt()', () => { assert.notEqual(text, encrypt(text)); }); - it('decrypt():', () => { + it('decrypt()', () => { var encrypted = encrypt(text); assert.equal(text, decrypt(encrypted)); }); - it('decryptJSON():', () => { + it('decryptJSON()', () => { var encrypted = encrypt(data); assert.equal(data, decrypt(encrypted).toString()); }); - it('connect():', (done) => { - var value = 0; - var test = () => { - connect(uuid, (request) => { - if (!typeof request === 'object' && value++ < 5) { - test(); - } - else { - assert.isObject(request); - done(); - } - }); - } - - test(); + it('connect()', (done) => { + connect(uuid, (request) => { + assert.isObject(request); + done(); + }); }); - it('send():', (done) => { - var value = 0; - var test = () => { - send(uuid, text, (request) => { - if (!typeof request === 'object' && value++ < 5) { - test(); - } - else { - assert.isObject(request); - done(); - } - }); - } - - test(); + it('send()', (done) => { + send(uuid, text, (request) => { + assert.isObject(request); + done(); + }); }); });
\ No newline at end of file |