Page MenuHomePhabricator

WikibaseQualityConstraints: Test `suggestions.js` module
Open, LowPublic

Description

In T280650, a bug arose as a result of a typo, which could have been caught by some simple unit testing. However, the suggestion.js module in WikibaseQualityConstraints is not currently tested, nor is it easy to test, as it relies on some DOM querying and global state. With some modification to the files, however, we would be able to test (at the very least) the hook handler callback attached to wikibase.entityselector.search (See suggestions.js:118-163).

An exploration of this has begun in patch 692359

Requirements:

  • WikibaseQualityConstraints extension installed

ACs:

  • There are at least two unit tests covering all execution paths of the wikibase.entityselector.search hook handler.

Event Timeline

ItamarWMDE renamed this task from WikibsaeQualityConstraints: Test `suggestions.js` module to WikibaseQualityConstraints: Test `suggestions.js` module.May 18 2021, 10:33 AM

Since I didn't have much to do in camp for the past couple of days I was working on this, see patch.

Change 692359 had a related patch set uploaded (by Itamar Givon; author: Itamar Givon):

[mediawiki/extensions/WikibaseQualityConstraints@master] Make WBQC suggestions.js testable

https://gerrit.wikimedia.org/r/692359

Change 697042 had a related patch set uploaded (by Itamar Givon; author: Itamar Givon):

[mediawiki/extensions/WikibaseQualityConstraints@master] Extract the entity selector hook handler to a fcatory function

https://gerrit.wikimedia.org/r/697042

Change 697064 had a related patch set uploaded (by Itamar Givon; author: Itamar Givon):

[mediawiki/extensions/WikibaseQualityConstraints@master] Refactor EntitySelectorHookHandlerFactory into consistant pattern

https://gerrit.wikimedia.org/r/697064

Change 697042 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Extract the entity selector hook handler to a factory function

https://gerrit.wikimedia.org/r/697042

Change 692359 abandoned by Itamar Givon:

[mediawiki/extensions/WikibaseQualityConstraints@master] Simplify functions and signatures

Reason:

https://gerrit.wikimedia.org/r/692359

Change 697064 abandoned by Itamar Givon:

[mediawiki/extensions/WikibaseQualityConstraints@master] Refactor EntitySelectorHookHandlerFactory into consistent pattern

Reason:

https://gerrit.wikimedia.org/r/697064