A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
759 B

12 years ago
  1. var common = require('../../common');
  2. var connection = common.createConnection({socketPath: common.fakeServerSocket});
  3. var assert = require('assert');
  4. var server = common.createFakeServer();
  5. var didConnect = false;
  6. server.listen(common.fakeServerSocket, function(err) {
  7. if (err) throw err;
  8. connection.connect(function(err) {
  9. if (err) throw err;
  10. assert.equal(didConnect, false);
  11. didConnect = true;
  12. connection.destroy();
  13. server.destroy();
  14. });
  15. });
  16. var hadConnection = false;
  17. server.on('connection', function(connection) {
  18. connection.handshake();
  19. assert.equal(hadConnection, false);
  20. hadConnection = true;
  21. });
  22. process.on('exit', function() {
  23. assert.equal(didConnect, true);
  24. assert.equal(hadConnection, true);
  25. });