aboutsummaryrefslogtreecommitdiff
path: root/src/test.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/test.js')
-rw-r--r--src/test.js52
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