sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0

add first modul testing

This commit is contained in:
Martin Geno 2016-09-01 22:19:08 +02:00
parent 10b6a7d47b
commit 908f09a014
4 changed files with 33 additions and 1 deletions

View File

@ -4,6 +4,7 @@ request = require('request')
lib = require('./lib') lib = require('./lib')
config = require('./config') config = require('./config')
modules = require('./modul')
describe('API',-> describe('API',->
it('status',(done)-> it('status',(done)->
@ -625,6 +626,7 @@ describe('API',->
) )
) )
) )
modules()
describe('delete',-> describe('delete',->
it('-> without login',(done)-> it('-> without login',(done)->
request({method: 'GET',uri:config.ADDRESS+"/delete"},(err,res,body)-> request({method: 'GET',uri:config.ADDRESS+"/delete"},(err,res,body)->

View File

@ -17,5 +17,5 @@ module.exports.login = (args,args2)->
expect(err).to.be.null expect(err).to.be.null
expect(res.statusCode).to.be.equal(200) expect(res.statusCode).to.be.equal(200)
expect(body.data).to.be.true expect(body.data).to.be.true
call(j) call(j,body.session)
) )

6
tests/modul/index.coffee Normal file
View File

@ -0,0 +1,6 @@
web = require('./web')
module.exports = ()->
describe('MODULES',->
web()
)

24
tests/modul/web.coffee Normal file
View File

@ -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()
)
)
)
)