mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-24 04:54:51 -04:00
Add unit test for "America, the Beautiful" article redirection.
The expected redirection behavior is described on #106
This commit is contained in:
parent
0c2f340029
commit
f6ad260867
@ -39,11 +39,8 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Depending on the browser you use, you should launch these unit tests differently : <br/>
|
These unit tests should be run with Firefox.<br/>
|
||||||
<ul>
|
TODO : find out why they do not all run on Chromium
|
||||||
<li>Open this page from a file:/// URL for Firefox (for a reason I have to find, there's an error when running from an http://localhost URL)</li>
|
|
||||||
<li>Open this page from a http:// URL for Chromium/Chrome (through a local webserver, for example), because it does not allow to run a web worker from a file:/// URL</li>
|
|
||||||
</ul>
|
|
||||||
<div id="qunit"></div>
|
<div id="qunit"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -609,6 +609,24 @@ define(['jquery', 'title', 'archive', 'zimArchive', 'zimDirEntry', 'util', 'geom
|
|||||||
}
|
}
|
||||||
}).fail(errorHandlerAsyncTest);
|
}).fail(errorHandlerAsyncTest);
|
||||||
});
|
});
|
||||||
|
asyncTest("article 'America, the Beautiful' correctly redirects to 'America the Beautiful'", function() {
|
||||||
|
expect(6);
|
||||||
|
localZimArchive.getTitleByName("A/America,_the_Beautiful.html").then(function(title) {
|
||||||
|
ok(title !== null, "Title found");
|
||||||
|
if (title !== null) {
|
||||||
|
ok(title.isRedirect(), "Title is a redirect.");
|
||||||
|
equal(title.name(), "America, the Beautiful", "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(), "America the Beautiful", "Correct redirected title name.");
|
||||||
|
start();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
}).fail(errorHandlerAsyncTest);
|
||||||
|
});
|
||||||
asyncTest("Image 'm/RayCharles_AManAndHisSoul.jpg' can be loaded", function() {
|
asyncTest("Image 'm/RayCharles_AManAndHisSoul.jpg' can be loaded", function() {
|
||||||
expect(4);
|
expect(4);
|
||||||
localZimArchive.getTitleByName("I/m/RayCharles_AManAndHisSoul.jpg").then(function(title) {
|
localZimArchive.getTitleByName("I/m/RayCharles_AManAndHisSoul.jpg").then(function(title) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user