Skip to content

Commit 47757c4

Browse files
authored
HTML search: Ensure that checkRanking fails when the final entry is not found (#12608)
The ``checkRanking`` function in our test suite has a bug; it's currently possible for the final item in the expected ranking list *not* to be found in the result-set, and yet for the function to pass. **Expected Behaviour** The ``checkRanking`` function should confirm that all of the items specified in the ``expectedRanking`` argument appear within the ``results`` argument, and in the list-iteration-order provided. If they do not, then an assertion error should be raised, failing the test. **Actual Behaviour** If all items up until the final entry in the ``expectedRanking`` argument are found in the expected order, but the final entry itself is not found at all in the ``results``, then no assertion error is raised, and the test passes.
1 parent fe9be8b commit 47757c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/js/searchtools.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('Basic html theme search', function() {
2222
}
2323

2424
expect(remainingItems.length).toEqual(0);
25+
expect(nextExpected).toEqual(undefined);
2526
}
2627

2728
describe('terms search', function() {
@@ -137,7 +138,7 @@ describe('Basic html theme search', function() {
137138

138139
expectedRanking = [
139140
['relevance', 'Relevance', ''], /* main title */
140-
['index', 'relevance.Example.relevance', '#module-relevance'], /* py:class attribute */
141+
['index', 'relevance.Example.relevance', '#relevance.Example.relevance'], /* py:class attribute */
141142
];
142143

143144
searchParameters = Search._parseQuery('relevance');

0 commit comments

Comments
 (0)