instance.js 447 B

1234567891011121314151617
  1. var test = require('tape');
  2. var traverse = require('../');
  3. var EventEmitter = require('events').EventEmitter;
  4. test('check instanceof on node elems', function (t) {
  5. var counts = { emitter : 0 };
  6. traverse([ new EventEmitter, 3, 4, { ev : new EventEmitter }])
  7. .forEach(function (node) {
  8. if (node instanceof EventEmitter) counts.emitter ++;
  9. })
  10. ;
  11. t.equal(counts.emitter, 2);
  12. t.end();
  13. });