Пример #1
0
  request.post({uri: path(''), body: file},function (err,res,body){
    it(err).equal(null)

    it(JSON.parse(body)).has({
      tests: it.ok()
    , modules: it.ok()
    })

    test.done()
  })
 github({body: {payload: JSON.stringify(post) } },function (err,obj){
   console.log(arguments)
   it(err).equal(null)
   it(obj).has({ok: it.ok()})  
   //and check if it's really in the database.
   test.done()
 })
Пример #3
0
 it(data.rows).every(function (e){
   it(e.doc).has({report: {meta: {depends: it.ok()}}})
   
   var depends = e.doc.report.meta.depends
   
   it(depends).every(
     it.has({
       filename : it.typeof('string')
     , resolves : it.typeof('object')
     , package:
       { name   : it.typeof('string')
       , version: it.typeof('string') }
     })
   )
 })
Пример #4
0
var Reporter = require('test-report')
  , it = require('it-is')
function report (name) {
  var reporter = new Reporter (name)
  module.exports[name] = reporter.report
  return reporter
}

report ('fixtures/pass.asynct.js')
  .test('pass1').test('pass2').test('pass2')
  
report ('fixtures/fail.asynct.js')
  .test('fail1', { name: 'AssertionError' })
  .test('fail2', { name: 'AssertionError' })
  .test('fail3', { name: 'AssertionError' })

  
report ('fixtures/error.asynct.js')
  .test('error1', {message: "EXAMPLE ERROR", stack: it.ok()})
  .test('error2', {message: "EXAMPLE ERROR", stack: it.ok()})
  .test('error3', {type:'non_object_property_load', stack: it.ok()})
  .test('error4', {type:'called_non_callable', stack: it.ok()})
  .test('error5', {type:'stack_overflow'})
  .test('error6', null) //a thrown null object
Пример #5
0
 function validate(row){
   return it.property('rows', it.every(row || row_valid).property('length', it.ok()))  
 }
Пример #6
0
  , summary_valid = it.has({
      commit: it.typeof('string')
    , total: it.typeof('number')
    , passes: it.typeof('number')
    , status: it.typeof('string')
    , time: function (actual){
        it(new Date(actual).toString()).notEqual('Invalid Date')
      }
    })
  , row_valid = 
      it.has({
        key: it.instanceof(Array)
      , value: summary_valid
      })
  , view_valid = 
      it.property('rows', it.every(row_valid).property('length', it.ok()))  

  function validate(row){
    return it.property('rows', it.every(row || row_valid).property('length', it.ok()))  
  }
  
exports.__setup = function (test) {
  
  console.error("init database")
  console.log(opts)
  db = require('../initialize')(opts, function (err,db){
    if(err){
      console.error("DATABASE SETUP ERROR")
      throw err
    }