Skip to content

IS-5161 Stub window.__CONFIG__ in setupTests for jsdom#160

Draft
aleixsuau wants to merge 1 commit into
integration/IS-5161/login-web-appfrom
fix/IS-5161/fix-tests-bootstrap-config-import-error
Draft

IS-5161 Stub window.__CONFIG__ in setupTests for jsdom#160
aleixsuau wants to merge 1 commit into
integration/IS-5161/login-web-appfrom
fix/IS-5161/fix-tests-bootstrap-config-import-error

Conversation

@aleixsuau
Copy link
Copy Markdown
Contributor

Jira: https://curity.atlassian.net/browse/IS-5161

Summary

  • bootstrap-configuration.ts throws at import time if window.__CONFIG__ is unset. jsdom doesn't run loader.vm.html, so any suite transitively importing the data-access barrel crashed at module load.
  • Inject a minimal stub in setupTests.ts so the test env honors the same "world configured before import" invariant the production loader provides.
  • Drop the now-redundant per-suite vi.mock('bootstrap-configuration') in HaapiStepper.spec.tsx; the assertion that referenced its initialUrl now reads from the real configuration export.

bootstrap-configuration.ts throws at import time if window.__CONFIG__
is unset. jsdom doesn't run loader.vm.html, so the import-time check
crashed any suite transitively importing the data-access barrel.

Inject a minimal stub in setupTests.ts so the test env honors the same
"world configured before import" invariant the production loader
provides. Drop the now-redundant vi.mock of bootstrap-configuration in
HaapiStepper.spec.tsx and read configuration.initialUrl from the real
export.
tokenEndpoint: 'https://example.test/oauth/token',
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the need come up because of other test files?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants