-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from AndyBitz/support-for-binary-files
Support for binary files
- Loading branch information
Showing
5 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var should = require("should"); | ||
var CachedSource = require("../lib/CachedSource"); | ||
var OriginalSource = require('../lib/OriginalSource'); | ||
|
||
describe("CachedSource", function() { | ||
it("should return the correct size for binary files", function() { | ||
var source = new OriginalSource(new ArrayBuffer(256), "file.wasm"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.size().should.be.eql(256); | ||
cachedSource.size().should.be.eql(256); | ||
}); | ||
|
||
it("should return the correct size for cached binary sources", function() { | ||
var source = new OriginalSource(new ArrayBuffer(256), "file.wasm"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.source(); | ||
cachedSource.size().should.be.eql(256); | ||
cachedSource.size().should.be.eql(256); | ||
}); | ||
|
||
it("should return the correct size for text files", function() { | ||
var source = new OriginalSource("TestTestTest", "file.js"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.size().should.be.eql(12); | ||
cachedSource.size().should.be.eql(12); | ||
}); | ||
|
||
it("should return the correct size for cached text files", function() { | ||
var source = new OriginalSource("TestTestTest", "file.js"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.source(); | ||
cachedSource.size().should.be.eql(12); | ||
cachedSource.size().should.be.eql(12); | ||
}); | ||
|
||
it("should return the correct size for unicode files", function() { | ||
var source = new OriginalSource("😋", "file.js"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.size().should.be.eql(4); | ||
cachedSource.size().should.be.eql(4); | ||
}); | ||
|
||
it("should return the correct size for cached unicode files", function() { | ||
var source = new OriginalSource("😋", "file.js"); | ||
var cachedSource = new CachedSource(source); | ||
|
||
cachedSource.source(); | ||
cachedSource.size().should.be.eql(4); | ||
cachedSource.size().should.be.eql(4); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters