aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-09-28 22:10:53 +0300
committerValentin Popov <info@valentineus.link>2017-09-28 22:10:53 +0300
commitb75c1114c3bb412937aaef9afe8a2fb9da0c14f3 (patch)
treed864742a9345c6a0b63a140813706dbd4b08dde1 /src
parentba42758715c8f93a5ce50a9201659979d43897fe (diff)
downloadiii-client-b75c1114c3bb412937aaef9afe8a2fb9da0c14f3.tar.xz
iii-client-b75c1114c3bb412937aaef9afe8a2fb9da0c14f3.zip
Simple tests have been added
Diffstat (limited to 'src')
-rw-r--r--src/test.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test.js b/src/test.js
new file mode 100644
index 0000000..5d64f33
--- /dev/null
+++ b/src/test.js
@@ -0,0 +1,42 @@
+import { assert } from 'chai';
+
+import {
+ decryptJSON,
+ connect,
+ decrypt,
+ encrypt,
+ send
+} from './index';
+
+describe('iii-client:', () => {
+ var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
+ var cuid = '0340feab-b09e-4960-96e9-c9518b1fb157';
+ var text = 'Hello, World!';
+ var data = JSON.stringify({ text });
+
+ it('encrypt():', () => {
+ assert.notEqual(text, encrypt(text));
+ });
+
+ it('decrypt():', () => {
+ var encrypted = encrypt(text);
+ assert.equal(text, decrypt(encrypted));
+ });
+
+ it('decryptJSON():', () => {
+ var encrypted = encrypt(data);
+ assert.equal(data, decrypt(encrypted).toString());
+ });
+
+ it('connect():', () => {
+ connect(uuid, (request) => {
+ assert.isObject(request);
+ });
+ });
+
+ it('send():', () => {
+ send(cuid, text, (request) => {
+ assert.isObject(request);
+ });
+ });
+}); \ No newline at end of file