From 1b31b0beec9d3011c444c70ec11f4da134570cb0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 9 Oct 2017 23:47:44 +0400 Subject: General code refactoring --- src/test.js | 52 +++++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'src/test.js') 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 -- cgit v1.2.3