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.

24 lines
739 B

  1. var Sender = require('../lib/Sender');
  2. require('should');
  3. describe('Sender', function() {
  4. describe('#frameAndSend', function() {
  5. it('does not modify a masked binary buffer', function() {
  6. var sender = new Sender({ write: function() {} });
  7. var buf = new Buffer([1, 2, 3, 4, 5]);
  8. sender.frameAndSend(2, buf, true, true);
  9. buf[0].should.eql(1);
  10. buf[1].should.eql(2);
  11. buf[2].should.eql(3);
  12. buf[3].should.eql(4);
  13. buf[4].should.eql(5);
  14. });
  15. it('does not modify a masked text buffer', function() {
  16. var sender = new Sender({ write: function() {} });
  17. var text = 'hi there';
  18. sender.frameAndSend(1, text, true, true);
  19. text.should.eql('hi there');
  20. });
  21. });
  22. });