Skip to content

test(bulk-import): cover the NFS wiring, not just the translations module - #4484

Open
gustavolira wants to merge 1 commit into
mainfrom
agent/16455-bulk-import-nfs-wiring
Open

test(bulk-import): cover the NFS wiring, not just the translations module#4484
gustavolira wants to merge 1 commit into
mainfrom
agent/16455-bulk-import-nfs-wiring

Conversation

@gustavolira

Copy link
Copy Markdown
Member

nfsExports.test.ts asserts only that the translations module exists and is exported as default. That module is a separate FrontendModule with pluginId: 'app', so both assertions hold against a bulk-import plugin whose own extensions array is empty — the page and the API disappear from the app with no error, no console warning, exit 0.

Same shape as #4470 for adoption-insights, which merged earlier today.

What's added

Three tests reading what the app actually resolves off the extensions:

  • the page's routePath and title
  • that the page and the API extension are registered on the plugin
  • that both route refs survive, including the tasks subRouteRef

Mutation-verified

Each mutation applied to src/index.tsx, suite re-run, source restored:

Mutation Result
page dropped from extensions 2 failed
api dropped from extensions 1 failed
path: '/bulk-import' changed 1 failed
title: 'Bulk import' changed 1 failed
routeRef: rootRouteRef removed 1 failed
tasks: importHistoryRouteRef removed 1 failed

Six for six, and the counts separate the tests: dropping the page fails two, dropping the api fails only the registration one, dropping the subroute fails only the routes one.

One finding worth carrying to the next plugin

The adoption-insights test asserts toBe(rootRouteRef) on the route ref and passes. The same assertion fails here.

createFrontendPlugin re-wraps route refs — probed it, and the object the plugin holds carries neither id nor params, so it is not the one routes.ts exported:

imported  : {"id":"bulk-import","params":[],"$$type":"@backstage/RouteRef","version":"v1"}
on plugin : {"$$type":"@backstage/RouteRef","version":"v1"}

Identity happens to survive for a plugin with a single route and does not for one that also declares a subRouteRef. That is a property of the wrapping, not of the plugin being correct, so this test asserts presence instead — which the mutation table above confirms still catches removal.

Flagging it because RHIDP-16455 has ten more plugins to go and toBe would look like the established pattern.

Verification

From workspaces/bulk-import: yarn tsc, yarn lint and yarn prettier --check all clean; the suite runs 5 tests.

@backstage/frontend-test-utils is added at ^0.6.1, the range four other workspaces use at this manifest version.

Part of RHIDP-16455.

…dule

nfsExports.test.ts asserted only that the translations module exists and is
exported as default. That module is a separate FrontendModule with
pluginId 'app', so both assertions hold against a bulk-import plugin whose own
`extensions` array is empty — the page and the API disappear from the app with
no error, no console warning, exit 0.

Adds what the app resolves off the extensions: the page's routePath and title,
that the page and the API are registered on the plugin, and that both route
refs survive.

Mutation-verified, six for six:

  page dropped from extensions   -> 2 failed
  api dropped from extensions    -> 1 failed
  path '/bulk-import'            -> 1 failed
  title 'Bulk import'            -> 1 failed
  routeRef removed               -> 1 failed
  tasks subRouteRef removed      -> 1 failed

One thing worth knowing before this pattern is copied further. The equivalent
test in adoption-insights asserts `toBe(rootRouteRef)` on the route ref, and
that passes there. It fails here: createFrontendPlugin re-wraps route refs, so
the object the plugin holds is not the one routes.ts exported — probed it and
the wrapped one carries neither `id` nor `params`. Identity happens to survive
for a plugin with a single route and does not for this one, which is a property
of the wrapping rather than of the plugin being correct. Asserting presence
still catches removal, which the mutation above confirms.

Part of RHIDP-16455.
@rhdh-gh-app

rhdh-gh-app Bot commented Aug 27, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-bulk-import workspaces/bulk-import/plugins/bulk-import patch v8.0.3

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.62%. Comparing base (769d370) to head (0554193).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4484   +/-   ##
=======================================
  Coverage   61.62%   61.62%           
=======================================
  Files        2569     2569           
  Lines      102831   102831           
  Branches    28837    28837           
=======================================
  Hits        63367    63367           
  Misses      38909    38909           
  Partials      555      555           
Flag Coverage Δ *Carryforward flag
adoption-insights 84.55% <ø> (ø) Carriedforward from 769d370
ai-integrations 69.09% <ø> (ø) Carriedforward from 769d370
app-defaults 55.55% <ø> (ø) Carriedforward from 769d370
augment 46.67% <ø> (ø) Carriedforward from 769d370
boost 79.84% <ø> (ø) Carriedforward from 769d370
bulk-import 72.79% <ø> (ø)
cost-management 13.55% <ø> (ø) Carriedforward from 769d370
dcm 72.09% <ø> (ø) Carriedforward from 769d370
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from 769d370
e2e-extensions 62.13% <ø> (ø) Carriedforward from 769d370
e2e-global-header 49.45% <ø> (ø) Carriedforward from 769d370
e2e-homepage 61.11% <ø> (ø) Carriedforward from 769d370
e2e-intelligent-assistant 46.65% <ø> (ø) Carriedforward from 769d370
e2e-orchestrator 49.52% <ø> (ø) Carriedforward from 769d370
e2e-orchestrator-plugin 49.51% <ø> (ø) Carriedforward from 769d370
e2e-quickstart 55.21% <ø> (ø) Carriedforward from 769d370
e2e-scorecard 50.21% <ø> (ø) Carriedforward from 769d370
e2e-theme 16.36% <ø> (ø) Carriedforward from 769d370
extensions 56.59% <ø> (ø) Carriedforward from 769d370
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 769d370
global-header 66.50% <ø> (ø) Carriedforward from 769d370
homepage 48.39% <ø> (ø) Carriedforward from 769d370
install-dynamic-plugins 58.57% <ø> (ø) Carriedforward from 769d370
intelligent-assistant 75.35% <ø> (ø) Carriedforward from 769d370
konflux 91.98% <ø> (ø) Carriedforward from 769d370
lightspeed 69.02% <ø> (ø) Carriedforward from 769d370
mcp-integrations 84.14% <ø> (ø) Carriedforward from 769d370
orchestrator 70.87% <ø> (ø) Carriedforward from 769d370
quickstart 63.74% <ø> (ø) Carriedforward from 769d370
sandbox 79.56% <ø> (ø) Carriedforward from 769d370
scorecard 87.41% <ø> (ø) Carriedforward from 769d370
theme 88.91% <ø> (ø) Carriedforward from 769d370
translations 5.12% <ø> (ø) Carriedforward from 769d370
x2a 77.10% <ø> (ø) Carriedforward from 769d370

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 769d370...0554193. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant