Browse Source

Test suite skeleton. Closes #6

Michelle Bu 12 years ago
parent
commit
c9e6476094
2 changed files with 73 additions and 0 deletions
  1. 5 0
      package.json
  2. 68 0
      test/server.js

+ 5 - 0
package.json

@@ -14,5 +14,10 @@
     "restify": "~2.3.5",
     "ws": "~0.4.25",
     "optimist": "*"
+  },
+  "devDependencies": {
+    "expect.js": "*",
+    "sinon": "*",
+    "mocha": "*"
   }
 }

+ 68 - 0
test/server.js

@@ -0,0 +1,68 @@
+var PeerServer = require('../').PeerServer;
+var expect = require('expect.js');
+var sinon = require('sinon');
+
+describe('PeerServer', function() {
+  describe('constructor', function() {
+    before(function() {
+      PeerServer.prototype._initializeWSS = sinon.stub();
+      PeerServer.prototype._initializeHTTP = sinon.stub();
+    });
+
+    it('should be able to be created without the `new` keyword', function() {
+      var p = PeerServer();
+      expect(p.constructor).to.be(PeerServer);
+    });
+
+    it('should default to port 80, key `peerjs`', function() {
+      var p = new PeerServer();
+      expect(p._options.key).to.be('peerjs');
+      expect(p._options.port).to.be(80);
+    });
+
+    it('should accept a custom port', function() {
+      var p = new PeerServer({ port: 8000 });
+      expect(p._options.port).to.be(8000);
+    });
+  });
+
+  describe('#_initializeWSS', function() {
+
+  });
+
+  describe('#_configureWS', function() {
+
+  });
+
+  describe('#_checkKey', function() {
+
+  });
+
+  describe('#_initializeHTTP', function() {
+
+  });
+
+  describe('#_startStreaming', function() {
+
+  });
+
+  describe('#_pruneOutstanding', function() {
+
+  });
+
+  describe('#_processOutstanding', function() {
+
+  });
+
+  describe('#_removePeer', function() {
+
+  });
+
+  describe('#_handleTransmission', function() {
+
+  });
+
+  describe('#_generateClientId', function() {
+
+  });
+});