Skip to content

refactor(web): export appConfig and add main.spec.ts for bootstrap verification#600

Merged
kyasbal merged 1 commit intoGoogleCloudPlatform:mainfrom
kyasbal:feature/app-config-test
Apr 8, 2026
Merged

refactor(web): export appConfig and add main.spec.ts for bootstrap verification#600
kyasbal merged 1 commit intoGoogleCloudPlatform:mainfrom
kyasbal:feature/app-config-test

Conversation

@kyasbal
Copy link
Copy Markdown
Member

@kyasbal kyasbal commented Apr 7, 2026

Motivation

During the merge of #585, some modules that should have been extracted (e.g., using importProvidersFrom) were not expanded correctly, causing application initialization to fail. To prevent similar root module configuration errors from passing undetected in the future, this PR adds a unit test to verify that application initialization completes successfully.

Changes

  • main.ts: Refactored to export appConfig as an ApplicationConfig object. This makes the DI configuration testable.
  • main.spec.ts: Added a new test file that uses TestBed and ApplicationInitStatus to verify that all APP_INITIALIZERs execute without errors.
  • root.component.ts: Moved KHIIconRegistrationModule and environment.pluginModules from component imports to main.ts providers to centralize application-level dependencies.

Motivation(日本語訳)

#585 のマージの際、モジュール内を展開(importProvidersFrom などを使用)すべきところを展開しておらず、アプリケーションの初期化に失敗するバグが発生しました。今後、ルートモジュールの構成ミスによってアプリケーションが起動できなくなるのをテストで確実に検知できるようにするため、このPRでは起動設定のテストを追加しました。

Changes(日本語訳)

  • main.ts: bootstrapApplication に渡していた設定を appConfig としてエクスポートし、テスト可能にしました。
  • main.spec.ts: TestBedApplicationInitStatus を使用して、すべての APP_INITIALIZER がエラーなく実行されることを確認するテストを追加しました。
  • root.component.ts: コンポーネントの imports にあった KHIIconRegistrationModuleenvironment.pluginModulesmain.tsproviders に移動し、アプリケーションレベルの依存関係を集約しました。

- Removed `KHIIconRegistrationModule` and `...environment.pluginModules` from `imports` in `web/src/app/root.component.ts`.
- Removed imports of `KHIIconRegistrationModule` and `environment` from `web/src/app/root.component.ts`.
- Created `web/src/main.spec.ts` with a test for `appConfig` initialization.
- In `web/src/main.ts`, moved the configuration object from `bootstrapApplication` to a new exported `appConfig` constant.
- Added `importProvidersFrom(KHIIconRegistrationModule)` and `importProvidersFrom(...environment.pluginModules)` to `appConfig.providers` in `web/src/main.ts`.
@kyasbal kyasbal requested review from jyane and renamoo as code owners April 7, 2026 23:40
@kyasbal kyasbal added the bug Something isn't working label Apr 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Angular bootstrap process by moving configuration into a standalone appConfig object and migrating module imports to application providers. It also adds a new test file web/src/main.spec.ts to verify application initialization. I have no feedback to provide as there were no review comments to evaluate.

@kyasbal kyasbal requested a review from K53 April 8, 2026 00:05
@kyasbal kyasbal added this pull request to the merge queue Apr 8, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 659a3ac Apr 8, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants