riot-translatebot

A simple riot bot which provides Status about Weblate
git clone git://archive.git.mtrnord.blog/Nordgedanken/riot-translatebot.git
Log | Files | Refs | README | LICENSE

commit b0880ddd5377b45b13e4ea3ec0ec4cecb4c8831b
parent aa6e3ea9bd0122b55691b323c14840088718b056
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 20 Jun 2017 08:51:47 +0200

Add login tests and prepare command help

Signed-off-by: Marcel <mtrnord1@gmail.com>

Diffstat:
Mpackage.json | 1+
Atest/commands_test.js | 17+++++++++++++++++
Dtest/index_test.js | 10----------
Atest/login_test.js | 25+++++++++++++++++++++++++
4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/package.json b/package.json @@ -40,6 +40,7 @@ "babel-register": "^6.24.1", "chai": "^4.0.2", "chai-as-promised": "^7.0.0", + "chai-fs": "^1.0.0", "mocha": "^3.4.2" } } diff --git a/test/commands_test.js b/test/commands_test.js @@ -0,0 +1,16 @@ +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import login from '../lib/login'; +import commands from '../lib/commands'; + +chai.use(chaiAsPromised); + +chai.should(); + +describe('Commands', () => { + const mx = new login; + mx.getClient().then(() => { + //TODO add test + it('should answer with help'); + }); +}); +\ No newline at end of file diff --git a/test/index_test.js b/test/index_test.js @@ -1,9 +0,0 @@ -//TODO Add actual test -var assert = require('assert'); -describe('Array', function() { - describe('#indexOf()', function() { - it('should return -1 when the value is not present', function() { - assert.equal(-1, [1,2,3].indexOf(4)); - }); - }); -}); -\ No newline at end of file diff --git a/test/login_test.js b/test/login_test.js @@ -0,0 +1,24 @@ +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import login from '../lib/login'; +import chai_fs from 'chai-fs'; + +chai.use(chai_fs); +chai.use(chaiAsPromised); + +const expect = chai.expect; + +chai.should(); + +describe('Login', () => { + const mx = new login; + it('should eventually login', done => { + const client = mx.getClient(); + client.should.be.fulfilled.and.notify(done); + }); + it('should have generated a device json file', () => { + mx.getClient().then(client => { + return expect('./user_data.json').to.be.a.file().with.json; + }); + }) +}); +\ No newline at end of file