From 3e63ac49706a4ddf577973654e1fba184e297086 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 16 Jun 2017 20:51:56 -0400 Subject: [PATCH] Use alice epub for section#find() tests --- test/section.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/test/section.js b/test/section.js index b92db5d..f983d1b 100644 --- a/test/section.js +++ b/test/section.js @@ -3,34 +3,30 @@ var ePub = require('../src/epub'); describe("section", function() { it("finds a single result in a section", function() { - var book = ePub("./fixtures/moby-dick/", {width: 400, height: 400}); + var book = ePub("./fixtures/alice/", {width: 400, height: 400}); return book.ready.then(function() { var section = book.section("chapter_001.xhtml"); return section.load().then(function() { - var results = section.find("pythagorean maxim"); + var results = section.find("they were filled with cupboards and book-shelves"); assert.equal(results.length, 1); - assert.equal(results[0].cfi, "epubcfi(/6/14[xchapter_001]!/4/2/24/2[c001p0011],/1:227,/1:244)"); - assert.equal(results[0].excerpt, "...r more prevalent than winds from astern (that is, if you never violate the Pythagorean maxim), so for the most part the Commodore on the quarter-deck ..."); + assert.equal(results[0].cfi, "epubcfi(/6/8[chapter_001]!/4/2/16,/1:275,/1:323)"); + assert.equal(results[0].excerpt, "... see anything; then she looked at the sides of the well and\n\t\tnoticed that they were filled with cupboards and book-shelves; here and there she saw\n\t\t..."); }); }); }); it("finds multiple results in a section", function() { - var book = ePub("./fixtures/moby-dick/", {width: 400, height: 400}); + var book = ePub("./fixtures/alice/", {width: 400, height: 400}); return book.ready.then(function() { var section = book.section("chapter_001.xhtml"); return section.load().then(function() { - var results = section.find("yet"); - assert.equal(results.length, 4); - assert.equal(results[0].cfi, "epubcfi(/6/14[xchapter_001]!/4/2/10/2[c001p0004],/1:461,/1:464)"); - assert.equal(results[0].excerpt, "...e from lanes and alleys, streets and avenues—north, east, south, and west. Yet here they all unite. Tell me, does the magnetic virtue of the needles o..."); - assert.equal(results[1].cfi, "epubcfi(/6/14[xchapter_001]!/4/2/14/2[c001p0006],/1:639,/1:642)"); - assert.equal(results[1].excerpt, "...his pine-tree shakes down its sighs like leaves upon this shepherd’s head, yet all were vain, unless the shepherd’s eye were fixed upon the magic stre..."); - assert.equal(results[2].cfi, "epubcfi(/6/14[xchapter_001]!/4/2/16/2[c001p0007],/1:1019,/1:1022)"); - assert.equal(results[2].excerpt, "...s considerable glory in that, a cook being a sort of officer on ship-board—yet, somehow, I never fancied broiling fowls;—though once broiled, judiciou..."); - assert.equal(results[3].cfi, "epubcfi(/6/14[xchapter_001]!/4/2/28/2[c001p0015],/1:314,/1:317)"); - assert.equal(results[3].excerpt, "...dies, and jolly parts in farces—though I cannot tell why this was exactly; yet, now that I recall all the circumstances, I think I can see a little in..."); - }); + var results = section.find("white rabbit"); + assert.equal(results.length, 2); + assert.equal(results[0].cfi, "epubcfi(/6/8[chapter_001]!/4/2/8,/1:240,/1:252)"); + assert.equal(results[0].excerpt, "...e worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her...."); + assert.equal(results[1].cfi, "epubcfi(/6/8[chapter_001]!/4/2/20,/1:148,/1:160)"); + assert.equal(results[1].excerpt, "...ut it was\n\t\tall dark overhead; before her was another long passage and the White Rabbit was still\n\t\tin sight, hurrying down it. There was not a moment..."); + }); }); });