Closes #14, closes #15. Fix recovery path used when jp2 is requested at less than...
[bookreader.git] / BookReaderIA / test / unit / JSLocate.js
index 2d814bf..f98c1e4 100644 (file)
@@ -1,26 +1,38 @@
 // Tests for BookReaderJSLocate.php
 
-// $$$ TODO -- make the test host configurable/automagic
+// Depends on common.js
 
 module("JSLocate");
 
-testHost = 'http://www-testflip.archive.org';
-
-// Set up dummy BookReader class for JSLocate
-function BookReader() {
-};
-
-BookReader.prototype.init = function() {
-    return true;
-};
+// $$$ locate will fail when called from the same domain since the browser will not honour the
+//     redirect to the datanode
 
 asyncTest("JSLocate for notesonsubmarine00grea", function() {
     expect(1);
-    $.getScript(testHost + '/bookreader/BookReaderJSLocate.php?id=amonographonmec00buregoog',
+    $.getScript( jsLocateURL('notesonsubmarine00grea'),
         function(data, textStatus) {
-            equals(13, window.br.titleLeaf, 'br object should exist with title leaf 13. See https://bugs.launchpad.net/bookreader/+bug/517424');
+            equals(window.br.titleLeaf, 5, 'Metadata loaded.  See https://bugs.launchpad.net/bookreader/+bug/517424. Title leaf');
             start();
         }
     );
 });
 
+asyncTest("JSLocate for photographingclo00carprich", function() {
+    expect(1);
+    $.getScript( jsLocateURL('photographingclo00carprich'),
+        function(data, textStatus) {
+            equals(window.br.bookTitle, 'Photographing clouds from an airplane',  'Title of book');
+            start();
+        }
+    );
+});
+
+asyncTest("JSLocate for salmoncookbookho00panaiala", function() {
+    expect(1);
+    $.getScript( jsLocateURL('salmoncookbookho00panaiala'),
+        function(data, textStatus) {
+            equals(window.br.numLeafs, 40,  'Number of pages');
+            start();
+        }
+    );
+});