Improve kebabCase
usage in plugin request utils
#52411
Labels
[Package] E2E Tests
/packages/e2e-tests
[Tool] E2E Test Utils
/packages/e2e-test-utils
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
See the relevant code here:
gutenberg/packages/e2e-test-utils-playwright/src/request-utils/plugins.ts
Lines 28 to 30 in 667fa36
kebabCase
turns a plugin name like "SQLite Object Cache" intosq-lite-object-cache
, whereas the correct plugin slug would besqlite-object-cache
. Same for "DynaMo", which is turned intodyna-mo
instead ofdynamo
What is your proposed solution?
Use
toLowerCase()
before runningkebabCase()
. That's whatsanitize_title
does internally as well.I think that would solve most problems.
In addition to that, we could improve the error message when trying to activate a plugin with the wrong slug.
Example:
This could be achieved by going through the
pluginsMap
and comparing the input with existing slugs, checking for similarity. For example by first removing all hyphens from both strings and then seeing if there is a match.Bonus: we could actually do this comparison and choose the right plugin automatically, without annoying the developer. But not sure if that's desired.
The text was updated successfully, but these errors were encountered: