1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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" );
});
});
});
|