Use Test.createTestingModule() and provide mock values for the tokens that the dynamic module would have registered. This avoids spinning up the real dynamic module — which might connect to a real database — while still testing the service logic correctly.
Provide mock values for the tokens the dynamic module registers, not the module itself.
This isolates the test from infrastructure — no real database, HTTP client, or external service needed.
Use overrideProvider() when importing the real module graph but needing to swap one provider.
Export all token constants from your dynamic modules so tests can reference them without magic strings.