Permalink
Browse files

Merge pull request #52 from facebook/blobbuilder

Adding blobbuilder test.
NOTE: needs much more
  • Loading branch information...
darobin committed Jun 6, 2012
2 parents 612909f + dd5354b commit 5e8b47ec4e0e0a3fd53a89da5046b69a49a701da
Showing with 43 additions and 0 deletions.
  1. +4 −0 tests/blobbuilder/config.yml
  2. +39 −0 tests/blobbuilder/test.js
@@ -0,0 +1,4 @@
+---
+ r: 1
+ spec: "http://dev.w3.org/2009/dap/file-system/file-writer.html#the-blobbuilder-interface"
+ title: "BlobBuilder"
View
@@ -0,0 +1,39 @@
+test("BlobBuilder", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true );
+
+ assert( !!BlobBuilder, "BlobBuilder supported" );
+});
+
+test("BlobBuilder, Blob Slice", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true ),
+ value = "Oh Hai!",
+ builder, blob, slice;
+
+ if ( !BlobBuilder ) {
+ assert( false, "BlobBuilder not supported, skipping tests" );
+ } else {
+ blob = (new BlobBuilder()).getBlob();
+ slice = H.API( blob, "slice", true );
+
+ assert( slice, "blob.slice supported (" + slice.name + ")" );
+ }
+});
+
+test("BlobBuilder In Practice", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true ),
+ value = "Oh Hai!",
+ builder, blob;
+
+ if ( !BlobBuilder ) {
+ assert( false, "BlobBuilder not supported, skipping tests" );
+ } else {
+ builder = new BlobBuilder();
+ builder.append("Oh Hai!");
+
+ blob = builder.getBlob();
+
+ assert( H.isKindOf( blob, "Blob" ), "getBlob() supported" );
+ assert( blob.size === value.length, "blob.size is correct");
+ assert( "type" in blob, "blob.type supported" );
+ }
+});

0 comments on commit 5e8b47e

Please sign in to comment.