Skip to content

Commit

Permalink
HTML search: Ensure that checkRanking fails when the final entry …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
jayaddison authored Jul 17, 2024
1 parent fe9be8b commit 47757c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/js/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Basic html theme search', function() {
}

expect(remainingItems.length).toEqual(0);
expect(nextExpected).toEqual(undefined);
}

describe('terms search', function() {
Expand Down Expand Up @@ -137,7 +138,7 @@ describe('Basic html theme search', function() {

expectedRanking = [
['relevance', 'Relevance', ''], /* main title */
['index', 'relevance.Example.relevance', '#module-relevance'], /* py:class attribute */
['index', 'relevance.Example.relevance', '#relevance.Example.relevance'], /* py:class attribute */
];

searchParameters = Search._parseQuery('relevance');
Expand Down

0 comments on commit 47757c4

Please sign in to comment.