Skip to content

Commit

Permalink
add Base64ToBlob test from Filer
Browse files Browse the repository at this point in the history
  • Loading branch information
mudcube committed Jan 21, 2015
1 parent 4d0d0db commit 74121a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/idb.filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ if (exports === window && exports.RUNNING_TESTS) {
exports['DirectoryEntry'] = DirectoryEntry;
exports['resolveToFullPath_'] = resolveToFullPath_;
exports['Metadata'] = Metadata;
exports['Base64ToBlob'] = Base64ToBlob;
}

})(self); // Don't use window because we want to run in workers.
13 changes: 13 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ test('resolveLocalFileSystemURL', 12, function() {
}, onError);
});

test('Base64ToBlob()', 5, function() {
var dataURL = 'data:text/html;base64,VGhpcyBpcyBhIHRlc3QK';
var blob = Base64ToBlob(dataURL);
ok(blob.__proto__ == Blob.prototype, 'Result is a Blob');
equal(blob.size, window.atob('VGhpcyBpcyBhIHRlc3QK').length, 'blob.size');
equal(blob.type, 'text/html', 'blob.type');

var dataURL2 = 'data:text/html,<p>Hi there</p>';
var blob = Base64ToBlob(dataURL2);
equal(blob.size, '<p>Hi there</p>'.length, 'blob.size');
equal(blob.type, 'text/html', 'blob.type');
});

module('Metadata', {
setup: function() {
var self = this;
Expand Down

0 comments on commit 74121a2

Please sign in to comment.