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.

26 lines
715 B

12 years ago
  1. var common = require('../../common');
  2. var connection = common.createConnection({port: common.fakeServerPort});
  3. var assert = require('assert');
  4. var server = common.createFakeServer();
  5. var connectErr;
  6. server.listen(common.fakeServerPort, function(err) {
  7. if (err) throw err;
  8. connection.connect(function(err) {
  9. connectErr = err;
  10. server.destroy();
  11. });
  12. });
  13. server.on('connection', function(incomingConnection) {
  14. var errno = 1130; // ER_HOST_NOT_PRIVILEGED
  15. incomingConnection.deny('You suck.', errno);
  16. });
  17. process.on('exit', function() {
  18. assert.equal(connectErr.code, 'ER_HOST_NOT_PRIVILEGED');
  19. assert.ok(/You suck/.test(connectErr.message));
  20. assert.equal(connectErr.fatal, true);
  21. });