diff options
Diffstat (limited to 'lib/epub.js/test/epub.js')
-rw-r--r-- | lib/epub.js/test/epub.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/epub.js/test/epub.js b/lib/epub.js/test/epub.js new file mode 100644 index 0000000..d5d2516 --- /dev/null +++ b/lib/epub.js/test/epub.js @@ -0,0 +1,52 @@ +import assert from 'assert'; +import ePub from '../src/epub'; +// var sinon = require('sinon'); + + +describe('ePub', function() { + var server; + before(function(){ + /* + // var packageContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/package.opf', 'utf8'); + // var tocContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/toc.xhtml', 'utf8'); + var packageContents = require('./fixtures/moby-dick/OPS/package.opf'); + var tocContents = require('./fixtures/moby-dick/OPS/toc.xhtml'); + + server = sinon.fakeServer.create(); + server.autoRespond = true; + + server.respondWith("moby-dick/OPS/package.opf", [200, { + "Content-Type": "text/xml" + }, packageContents]); + + server.respondWith("moby-dick/OPS/toc.xhtml", [200, { + "Content-Type": "application/xhtml+xml" + }, tocContents]); + */ + + }); + after(function(){ + // server.restore(); + }); + + it('should open a epub', function() { + var book = ePub("/fixtures/alice/OPS/package.opf"); + + return book.opened.then(function(){ + assert.equal( book.isOpen, true, "book is opened" ); + assert.equal( book.url.toString(), "http://localhost:9876/fixtures/alice/OPS/package.opf", "book url is passed to new Book" ); + }); + }); + + it('should open a archived epub', function() { + var book = ePub("/fixtures/alice.epub"); + + // assert(typeof (JSZip) !== "undefined", "JSZip is present" ); + + return book.opened.then(function(){ + assert.equal( book.isOpen, true, "book is opened" ); + assert( book.archive, "book is unarchived" ); + }); + }); + +}); |