Switch to the Ray Charles ZIM file for unit tests

It's the one used by Kiwix team
This commit is contained in:
mossroy 2015-06-10 10:37:20 +02:00
parent 1ba3efd039
commit cfdb3225a9
4 changed files with 8 additions and 8 deletions

View File

@ -41,7 +41,7 @@
<body>
Please select all the files inside the archive wikipedia_small_2010-08-14 (included with source code) : wikipedia_*.dat, metadata.txt etc<br />
<input type="file" id="evopediaArchiveFiles" multiple /><br />
Please select wikipedia_cr_all_2015-04.zim file (included with source code too)<br />
Please select wikipedia_en_ray_charles_2015-06.zim file (included with source code too)<br />
<input type="file" id="zimArchiveFiles" multiple /><br />
<input type="button" id="runTests" value="Run tests" />
<div id="qunit"></div>

View File

@ -430,32 +430,32 @@ define(['jquery', 'title', 'archive', 'zimArchive', 'zimDirEntry', 'util', 'geom
});
module("zim_title_search_and_read");
asyncTest("check getTitleByName Arikitcac", function() {
asyncTest("check DirEntry.fromStringId 'A Fool for You'", function() {
// Construct the DirEntry for Arikitcac article
// NB : this must be done inside a test or asyncTest function, else the localZimArchive is not ready yet
var arikitcacDirEntry = zimDirEntry.DirEntry.fromStringId(localZimArchive._file, "7371|1|A|0|11|Arikitcac.html|Arikitcac");
var arikitcacDirEntry = zimDirEntry.DirEntry.fromStringId(localZimArchive._file, "5856|7|A|0|2|A_Fool_for_You.html|A Fool for You|false|undefined");
expect(2);
var callbackFunction = function(title, htmlArticle) {
ok(htmlArticle && htmlArticle.length > 0, "Article not empty");
// Remove new lines
htmlArticle = htmlArticle.replace(/[\r\n]/g, " ");
ok(htmlArticle.match("^.*<h1[^>]*>Arikitcac</h1>"), "'Arikitcac' title somewhere in the article");
ok(htmlArticle.match("^.*<h1[^>]*>A Fool for You</h1>"), "'A Fool for You' title somewhere in the article");
start();
};
localZimArchive.readArticle(arikitcacDirEntry, callbackFunction);
});
asyncTest("article Atim correctly redirects to Atimw", function() {
asyncTest("article '(The Night Time Is) The Right Time' correctly redirects to 'Night Time Is the Right Time'", function() {
expect(6);
localZimArchive.getTitleByName("Atim.html", function(title) {
localZimArchive.getTitleByName("(The_Night_Time_Is)_The_Right_Time.html", function(title) {
console.log(title);
ok(title !== null, "Title found");
ok(title.isRedirect(), "Title is a redirect.");
equal(title.name(), "Atim", "Correct redirect title name.");
equal(title.name(), "(The Night Time Is) The Right Time", "Correct redirect title name.");
localZimArchive.resolveRedirect(title, function(title) {
ok(title !== null, "Title found");
ok(!title.isRedirect(), "Title is not a redirect.");
equal(title.name(), "Atimw", "Correct redirected title name.");
equal(title.name(), "Night Time Is the Right Time", "Correct redirected title name.");
start();
});
});

Binary file not shown.

Binary file not shown.