Pārlūkot izejas kodu

Remove most old tests

Michelle Bu 11 gadi atpakaļ
vecāks
revīzija
4d6f655823
6 mainītis faili ar 1 papildinājumiem un 220 dzēšanām
  1. 0 4
      test/adapter.js
  2. 0 41
      test/connectionmanager.js
  3. 0 126
      test/dataconnection.js
  4. 0 16
      test/peer.js
  5. 0 32
      test/socket.js
  6. 1 1
      test/test.html

+ 0 - 4
test/adapter.js

@@ -1,9 +1,5 @@
 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');
   });

+ 0 - 41
test/connectionmanager.js

@@ -1,41 +0,0 @@
-describe('ConnectionManager', function() {
-
-  describe('constructor', function() {
-  });
-
-  it('inherits from EventEmitter');
-
-  describe('#_setupDataChannel', function() {
-  });
-
-  describe('#_makeOffer', function() {
-  });
-
-  describe('#_makeAnswer', function() {
-  });
-
-  describe('#_cleanup', function() {
-  });
-
-  describe('#_attachConnectionListeners', function() {
-  });
-
-  describe('#handleSDP', function() {
-  });
-
-  describe('#handleCandidate', function() {
-  });
-
-  describe('#handleLeave', function() {
-  });
-
-  describe('#close', function() {
-  });
-
-  describe('#connect', function() {
-  });
-
-  describe('#update', function() {
-  });
-
-});

+ 0 - 126
test/dataconnection.js

@@ -1,126 +0,0 @@
-describe('DataConnection', function() {
-
-  // Only run tests on compatible browser.
-  if (util.isBrowserCompatible()) {
-
-    var dc, pdc;
-
-    function DataChannelStub() {};
-    DataChannelStub.prototype = {
-      close: function() {
-        if (this.readyState === 'closed') {
-          throw Error();
-        }
-        this.readyState = 'closed';
-      },
-      // Only sends to peer's dc.
-      send: function(msg) {
-        pdc._handleDataMessage({ data: msg });
-      }
-    };
-
-    describe('constructor', function() {
-      it('should accept options properly', function() {
-        // Test without 'new' keyword.
-        dc = DataConnection('peer', null,
-          { serialization: 'json',
-            metadata: { message: 'I\'m testing!'} });
-
-        expect(dc.peer).to.be('peer');
-        expect(dc.serialization).to.be('json');
-        expect(dc.metadata.message).to.be('I\'m testing!');
-
-        expect(dc._dc).to.be(null);
-        dc._dc = new DataChannelStub();
-      });
-    });
-
-    it('inherits from EventEmitter');
-
-    before(function() {
-      dc = DataConnection('peer', null,
-        { serialization: 'json',
-          metadata: { message: 'I\'m testing!'} });
-      dc._dc = new DataChannelStub();
-    });
-
-    describe('#_configureDataChannel', function() {
-      it('should set the correct binaryType', function() {
-        dc._configureDataChannel();
-
-        if (util.browserisms === 'Firefox') {
-          expect(dc._dc.binaryType).to.be('arraybuffer');
-        } else {
-          expect(dc._reliable).to.be(undefined);
-        }
-      });
-
-      it('should fire an `open` event', function(done) {
-        dc.on('open', function() {
-          expect(dc.open).to.be(true)
-          done();
-        });
-        dc._dc.onopen();
-      });
-    });
-
-    describe('#_handleDataMessage', function() {
-
-    });
-
-    describe('#addDC', function() {
-      it('should add a DataConnection properly', function() {
-        pdc = new DataConnection('ignore', null, { serialization: 'json', reliable: true });
-        pdc.addDC(new DataChannelStub());
-
-        expect(pdc._dc).not.to.be(null);
-      });
-    });
-
-    describe('#send', function() {
-      it('should send data to the peer', function(done) {
-        pdc = new DataConnection('ignore', null, { serialization: 'json' });
-        pdc.on('data', function(data) {
-          expect(data.hello).to.be('peer-tester');
-          done();
-        });
-        dc.send({ hello: 'peer-tester' });
-      });
-    });
-
-    describe('#_cleanup', function() {
-      it('should emit a `close` event', function(done) {
-        var first = true;
-        dc.on('close', function() {
-          expect(dc.open).to.be(false)
-
-          // Calling it twice should be fine.
-          if (first) {
-            first = false;
-            dc._cleanup();
-          }
-
-          done();
-        });
-
-        dc._cleanup();
-      });
-    });
-
-    // Hacks hacks
-    describe('#close', function() {
-      it('should not call _cleanup', function() {
-        dc._cleanup = function() {
-          throw Error();
-        }
-
-        // Should not call _cleanup again.
-        dc.close();
-      });
-    });
-
-
-  } else {
-    it('should not work.', function() {});
-  }
-});

+ 0 - 16
test/peer.js

@@ -1,16 +0,0 @@
-describe('Peer', function() {
-
-  describe('constructor', function() {
-  });
-
-  it('inherits from EventEmitter');
-
-  describe('.browser', function() {
-    it('should be the current browser', function() {
-      var browser = window.mozRTCPeerConnection ? 'Firefox' : 'Unknown';
-      browser = window.webkitRTCPeerConnection ? 'Webkit' : browser;
-      expect(Peer.browser).to.be(browser);
-    });
-  });
-
-});

+ 0 - 32
test/socket.js

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

+ 1 - 1
test/test.html

@@ -12,8 +12,8 @@
   <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>
-  <script src="../lib/util.js"></script>
   <script src="../lib/adapter.js"></script>
+  <script src="../lib/util.js"></script>
   <script src="../lib/dataconnection.js"></script>
   <script src="../lib/peer.js"></script>
   <script src="../lib/socket.js"></script>