view node_modules/socket.io/node_modules/has-binary-data/test.js @ 77:cd921abc8887

added puredata trigger/OSC router
author Rob Canning <rob@foo.net>
date Tue, 15 Jul 2014 17:48:07 +0100
parents
children
line wrap: on
line source

var hasBinary = require('./');
var assert = require('better-assert');
var fs = require('fs');

describe('has-binarydata', function(){

  it('should work with buffer', function(){
    assert(hasBinary(fs.readFileSync('./test.js')));
  });

  it('should work with an array that contains a buffer', function() {
    var arr = [1, new Buffer('asdfasdf', 'utf8'), 2];
    assert(hasBinary(arr));
  });

  if (global.ArrayBuffer) {
      it('should work with an ArrayBuffer', function() {
        assert(hasBinary(new ArrayBuffer()));
      });
  }

  if (global.Blob) {
     it('should work with a Blob', function() {
        assert(hasBinary(new Blob()));
     });
  }

});