Skip to content

Commit

Permalink
start tests from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Mar 22, 2016
1 parent fe06b79 commit 7179920
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,8 @@

'use strict'

var ctrl = require('async')
var test = require('assertit')
var base = require('./index')

test('async-simple-iterator:', function () {
var obj = {
dev: './dev.json',
test: './test.json',
prod: './prod.json'
}
var iterator = base.wrapIterator(function (val, key, next) {
console.log('actual:', val, key)

if (key === 'dev') {
var err = new Error('foo:' + key)
err.value = val
next(err)
return
}

next(null, 123 + key + 456)
}, {settle: true})

base
.on('beforeEach', function (val, key, next) {
console.log('beforeEach:', val, key)
})
.on('afterEach', function (err, res, val, key, next) {
console.log('afterEach:', err, res, val, key)
})
.on('error', function (err, res, val, key, next) {
console.log('error:', err, res, val, key)
})

ctrl.forEachOf(obj, iterator, function (err) {
// if settle:false, `err`
// if settle:true, `null`
console.log('end:', err)
})
test('async-simple-iterator:', function (done) {
done()
})

0 comments on commit 7179920

Please sign in to comment.