fakeConnector.js 681 Bytes
import events from 'events';

/**
 * @class 假的连接器(用于单元测试)
 * @extends {EventEmitter}
 * @module Connector
 * @member {Socket} client
 * @member {Array} orderMq
 * @description 连接到读写器端
 */
class FakeConnector extends events.EventEmitter {
  constructor(config, send, receive) {
    super();
    this.connected = false;
    this.client = {};
    let that = this;

    //初始化
    process.nextTick(function() {
      that.connected = true;
      send();
    });
  }
  send() {

  }
  done(order, ret) {
    this.emit(order, ret);
  };
}

/**
 * @exports mock/FakeConnector
 */
export default FakeConnector;