fix: merge apps by appId, update runtime config tests, add mergeSiteConfig unit tests#1
Conversation
- Remove siteId from test config (no longer used) - Simplify configureCache mock (no URL param parsing needed) - Rename test to clarify it tests merge behavior - Test proper merge: runtime overrides build-time, build-time values preserved, runtime values added Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test that app-level config in runtime properly merges with build-time app config - Simulates full flow by calling addAppConfigs() after initialize - Verifies runtime overrides build-time, build-time preserved, and runtime additions work at the app config level Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4ec3514 to
2c1be1e
Compare
- Replace supportEmail with theme config (realistic optional config) - Use fake.url pattern for test URLs: - fake.config.url for runtime config endpoint - fake.cdn.url for CDN resources (theme, logos) - fake.lms.url for LMS base URL Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b28ddce to
b24a298
Compare
b24a298 to
952138f
Compare
- Add appConfigOnly option to mergeSiteConfig for runtime config - Runtime config: only merge config for existing apps, ignore new apps - Build-time config: full app merge by appId, allow adding new apps - Add lodash.keyby dependency for cleaner implementation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive unit tests covering all code paths in mergeSiteConfig: - Top-level config merging (new values, overrides, preservation) - App merging with full merge (default behavior) - App merging with appConfigOnly option - Edge cases (empty arrays, undefined apps, missing config) Uses jest.spyOn pattern for verifying publish(CONFIG_CHANGED) calls. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
952138f to
1f38da9
Compare
|
Summary
siteIdand simplifies URL handlingappIdinstead of array index (was causing bugs when configs had apps in different order)appConfigOnlyoption tomergeSiteConfigfor runtime config behaviormergeSiteConfigcovering all code pathsChanges
runtime/initialize.test.js
siteId, simplify mock, verify merge behavior (runtime overrides build-time, build-time preserved, runtime additions work)addAppConfigs()to verify app-specific config merging works correctlynewConfigfixture, usefake.urlpattern and realistic config shapesruntime/config/index.ts
appIdinstead of array index usinglodash.keybyappConfigOnlyoption: Whentrue, only merges theconfigproperty of existing apps (ignores new apps) - used by runtime config since routes/providers can't be sent via JSONruntime/config/index.test.ts (new)
Comprehensive unit tests for
mergeSiteConfig(14 tests):appConfigOnly: truepublish(CONFIG_CHANGED)is called in all pathsruntime/initialize.js
runtimeConfig()to callmergeSiteConfig(data, { appConfigOnly: true })Test plan
mergeSiteConfigcode pathsappIdverified (configs with different app order merge correctly)🤖 Generated with Claude Code