From 908f09a014e1ad086771b11b0931929e844ffe25 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Thu, 1 Sep 2016 22:19:08 +0200 Subject: [PATCH] add first modul testing --- tests/index.coffee | 2 ++ tests/lib.coffee | 2 +- tests/modul/index.coffee | 6 ++++++ tests/modul/web.coffee | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/modul/index.coffee create mode 100644 tests/modul/web.coffee diff --git a/tests/index.coffee b/tests/index.coffee index 7dfbbde..54bd42b 100644 --- a/tests/index.coffee +++ b/tests/index.coffee @@ -4,6 +4,7 @@ request = require('request') lib = require('./lib') config = require('./config') +modules = require('./modul') describe('API',-> it('status',(done)-> @@ -625,6 +626,7 @@ describe('API',-> ) ) ) + modules() describe('delete',-> it('-> without login',(done)-> request({method: 'GET',uri:config.ADDRESS+"/delete"},(err,res,body)-> diff --git a/tests/lib.coffee b/tests/lib.coffee index aac79cf..d630412 100644 --- a/tests/lib.coffee +++ b/tests/lib.coffee @@ -17,5 +17,5 @@ module.exports.login = (args,args2)-> expect(err).to.be.null expect(res.statusCode).to.be.equal(200) expect(body.data).to.be.true - call(j) + call(j,body.session) ) diff --git a/tests/modul/index.coffee b/tests/modul/index.coffee new file mode 100644 index 0000000..9702947 --- /dev/null +++ b/tests/modul/index.coffee @@ -0,0 +1,6 @@ +web = require('./web') + +module.exports = ()-> + describe('MODULES',-> + web() + ) diff --git a/tests/modul/web.coffee b/tests/modul/web.coffee new file mode 100644 index 0000000..e7e9d79 --- /dev/null +++ b/tests/modul/web.coffee @@ -0,0 +1,24 @@ +expect = require("chai").expect +request = require('request') + +lib = require('../lib') + +config = require('../config') + +module.exports = ()-> + describe('web',-> + it('test of test',(done)-> + lib.login((j,login)-> + request({method: 'GET',uri:config.ADDRESS+"/web/involve",jar:j},(err,res,body)-> + expect(err).to.be.null + expect(res.statusCode).to.be.equal(200) + if(typeof body == "string") + body = JSON.parse(body) + expect(body.error).to.be.undefined + expect(body.data).to.be.a("array") + console.log(login,body.data) + done() + ) + ) + ) + )