1 var Blob=require("../"),expect=require("expect.js");describe("blob",(function(){Blob?(it("should encode a proper sized blob when given a string argument",(function(){var e=new Blob(["hi"]);expect(e.size).to.be(2)})),it("should encode a blob with proper size when given two strings as arguments",(function(){var e=new Blob(["hi","hello"]);expect(e.size).to.be(7)})),it("should encode arraybuffers with right content",(function(e){for(var o=new Uint8Array(5),t=0;t<5;t++)o[t]=t;var r=new Blob([o.buffer]),n=new FileReader;n.onload=function(){for(var o=new Uint8Array(this.result),t=0;t<5;t++)expect(o[t]).to.be(t);e()},n.readAsArrayBuffer(r)})),it("should encode typed arrays with right content",(function(e){for(var o=new Uint8Array(5),t=0;t<5;t++)o[t]=t;var r=new Blob([o]),n=new FileReader;n.onload=function(){for(var o=new Uint8Array(this.result),t=0;t<5;t++)expect(o[t]).to.be(t);e()},n.readAsArrayBuffer(r)})),it("should encode sliced typed arrays with right content",(function(e){for(var o=new Uint8Array(5),t=0;t<5;t++)o[t]=t;var r=new Blob([o.subarray(2)]),n=new FileReader;n.onload=function(){for(var o=new Uint8Array(this.result),t=0;t<3;t++)expect(o[t]).to.be(t+2);e()},n.readAsArrayBuffer(r)})),it("should encode with blobs",(function(e){for(var o=new Uint8Array(5),t=0;t<5;t++)o[t]=t;var r=new Blob([new Blob([o.buffer])]),n=new FileReader;n.onload=function(){for(var o=new Uint8Array(this.result),t=0;t<5;t++)expect(o[t]).to.be(t);e()},n.readAsArrayBuffer(r)})),it("should enode mixed contents to right size",(function(){for(var e=new Uint8Array(5),o=0;o<5;o++)e[o]=o;var t=new Blob([e.buffer,"hello"]);expect(t.size).to.be(10)})),it("should accept mime type",(function(){var e=new Blob(["hi","hello"],{type:"text/html"});expect(e.type).to.be("text/html")})),it("should be an instance of constructor",(function(){var e=new Blob(["hi"]);expect(e).to.be.a(Blob),expect(e).to.be.a(global.Blob)}))):it("should not have a blob or a blob builder in the global namespace, or blob should not be a constructor function if the module exports false",(function(){try{var e=new Uint8Array(5).buffer;global.Blob([e]),expect().fail("Blob shouldn't be constructable")}catch(e){}var o=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;expect(o).to.be(void 0)}))}));