hc 12 ani în urmă
părinte
comite
b57fff1d96
8 a modificat fișierele cu 160 adăugiri și 8 ștergeri
  1. 1 0
      package.json
  2. 19 0
      test/adapter.js
  3. 0 7
      test/browser.js
  4. 65 0
      test/connection.js
  5. 25 0
      test/peer.js
  6. 23 0
      test/socket.js
  7. 8 1
      test/test.html
  8. 19 0
      test/util.js

+ 1 - 0
package.json

@@ -3,6 +3,7 @@
   "version": "0.1.0",
   "description": "PeerJS client library",
   "devDependencies": {
+    "uglify-js": "*",
     "mocha": "*",
     "expect.js": "*"
   }

+ 19 - 0
test/adapter.js

@@ -0,0 +1,19 @@
+describe('adapter', function() {
+
+  it('sets browerisms', function() {
+    expect(exports.util.browserisms).to.match(/^Firefox||Webkit$/)
+  })
+
+  it('sets RTCPeerConnection', function() {
+    expect(RTCPeerConnection).to.be.a('function');
+  })
+
+  it('sets RTCSessionDescription', function() {
+    expect(RTCSessionDescription).to.be.a('function');
+  })
+
+  it('sets getUserMedia', function() {
+    expect(getUserMedia).to.be.a('function');
+  })
+
+});

+ 0 - 7
test/browser.js

@@ -1,7 +0,0 @@
-describe('browser', function() {
-
-  it('implements RTCPeerConnection', function() {
-
-  })
-
-});

+ 65 - 0
test/connection.js

@@ -0,0 +1,65 @@
+describe('DataConnection', function() {
+
+  it('constructor');
+
+  it('inherits from EventEmitter');
+
+  it('initialize');
+
+  it('_setupOffer', function() {
+
+  });
+
+  it('_setupDataChannel', function() {
+
+  });
+
+  it('_startPeerConnection', function() {
+
+  });
+
+  it('_setupIce', function() {
+
+  });
+
+  it('_configureDataChannel', function() {
+
+  });
+
+  it('_makeOffer', function() {
+
+  });
+
+  it('_makeAnswer', function() {
+
+  });
+
+  it('_cleanup', function() {
+
+  });
+
+  it('_handleDataMessage', function() {
+
+  });
+
+  it('close', function() {
+
+  });
+
+  it('send', function() {
+
+  });
+
+  it('handleSDP', function() {
+
+  });
+
+  it('handleCandidate', function() {
+
+  });
+
+  it('handleLeave"', function() {
+
+  });
+
+});

+ 25 - 0
test/peer.js

@@ -0,0 +1,25 @@
+describe('Peer', function() {
+
+  it('constructor')
+
+  it('inherits from EventEmitter')
+
+  it('_getId')
+
+  it('_init')
+
+  it('_handleServerJSONMessage')
+
+  it('_processQueue')
+
+  it('_abort')
+
+  it('_cleanup')
+
+  it('_attachConnectionListeners')
+
+  it('connect')
+  
+  it('destroy')
+
+});

+ 23 - 0
test/socket.js

@@ -0,0 +1,23 @@
+describe('Socket', function() {
+
+  it('constructor')
+
+  it('inherits from EventEmitter')
+
+  it('start')
+
+  it('_startWebSocket')
+
+  it('_startXhrStream')
+
+  it('_handleStream')
+
+  it('_setHTTPTimeout')
+
+  it('send')
+
+  it('close')
+  
+  it('_wsOpen')
+
+});

+ 8 - 1
test/test.html

@@ -6,6 +6,9 @@
 </head>
 <body>
   <div id="mocha"></div>
+  <script>
+    var exports = this;
+  </script>
   <script src="../deps/js-binarypack/lib/bufferbuilder.js"></script>
   <script src="../deps/js-binarypack/lib/binarypack.js"></script>
   <script src="../deps/EventEmitter/EventEmitter.js"></script>
@@ -19,7 +22,11 @@
   <script src="../node_modules/mocha/mocha.js"></script>
   <script>mocha.setup('bdd')</script>
 
-  <script src="browser.js"></script>
+  <script src="adapter.js"></script>
+  <script src="util.js"></script>
+  <script src="connection.js"></script>
+  <script src="peer.js"></script>
+  <script src="socket.js"></script>
 
   <script>
     mocha.run();

+ 19 - 0
test/util.js

@@ -0,0 +1,19 @@
+describe('util', function() {
+
+  it('inherits', function() {
+
+  })
+
+  it('extend')
+  it('extend')
+  it('pack')
+  it('unpack')
+  it('randomPort')
+  it('log')
+  it('setZeroTimeout')
+  it('blobToArrayBuffer')
+  it('blobToBinaryString')
+  it('binaryStringToArrayBuffer')
+  it('randomToken')
+
+});