-
- Downloads
Align `label` and `message` props of `coalesceBadge()` with internal `makeBadge()` (#5719)
There is an internal `makeBadge()` function which is called from a few places in the server and from the public `makeBadge()` function which is a light wrapper. (Eventually we want to dogfood the public API: that's the work of #4950, and this helps with it by aligning the interfaces.) Related to that is #3370, which is about aligning the `serviceData` schema (i.e. the result of `handle()`) with the public `makeBadge()` function. A legacy quirk of the _private_ `makeBadge()` function is accepting a `text: ['label', 'message']` array instead of separate `{ label, message }` props like the rest of the codebase. `coalesceBadge()` has to translate from `{ label, message }` to `text: ['label', message']`. This removes that bit of indirection. It also rewrites most of the tests of `coalesceBadge()` to use `.includes()`, providing IMO a slight improvement in readability.
Showing
- badge-maker/lib/index.js 3 additions, 3 deletionsbadge-maker/lib/index.js
- badge-maker/lib/make-badge.js 4 additions, 4 deletionsbadge-maker/lib/make-badge.js
- badge-maker/lib/make-badge.spec.js 92 additions, 46 deletionsbadge-maker/lib/make-badge.spec.js
- core/base-service/base-svg-scraping.spec.js 1 addition, 8 deletionscore/base-service/base-svg-scraping.spec.js
- core/base-service/base.spec.js 2 additions, 1 deletioncore/base-service/base.spec.js
- core/base-service/coalesce-badge.js 4 additions, 6 deletionscore/base-service/coalesce-badge.js
- core/base-service/coalesce-badge.spec.js 73 additions, 70 deletionscore/base-service/coalesce-badge.spec.js
- core/base-service/examples.js 1 addition, 6 deletionscore/base-service/examples.js
- core/base-service/legacy-request-handler.js 1 addition, 1 deletioncore/base-service/legacy-request-handler.js
- core/server/server.js 6 additions, 3 deletionscore/server/server.js
Loading
Please register or sign in to comment