diff --git a/server/portal-auth-services-bootstrap.test.mjs b/server/portal-auth-services-bootstrap.test.mjs index e55e0eb..a4b7548 100644 --- a/server/portal-auth-services-bootstrap.test.mjs +++ b/server/portal-auth-services-bootstrap.test.mjs @@ -65,6 +65,20 @@ function createSetup(overrides = {}) { subscriptionOptions = receivedOptions; return { id: 'subscription' }; }, + createBillingAdminConfigServiceFn(receivedPool, receivedOptions) { + assert.equal(receivedPool, pool); + assert.equal(receivedOptions?.env, options.env); + calls.push(['billing-config']); + return { + id: 'billing-config', + async ensureSchema() { + calls.push(['billing-config-schema']); + }, + async getEffectiveBillingConfig() { + return { marginMultiplier: 1.2 }; + }, + }; + }, createUserAuthFn(receivedPool, receivedOptions) { assert.equal(receivedPool, pool); calls.push(['user-auth']); @@ -161,11 +175,13 @@ test('preserves subscription, auth, and user-space wiring', async () => { let captured = setup.getCaptured(); assert.deepEqual( - setup.calls.slice(0, 4).map(([name]) => name), + setup.calls.slice(0, 6).map(([name]) => name), [ 'plan-schema', 'plan-service', 'subscription-service', + 'billing-config', + 'billing-config-schema', 'user-auth', ], ); @@ -173,6 +189,11 @@ test('preserves subscription, auth, and user-space wiring', async () => { result.subscriptionService._planCatalogService, setup.planCatalogService, ); + assert.equal(result.billingConfigService?.id, 'billing-config'); + assert.equal( + captured.userAuthOptions.billingConfigService?.id, + 'billing-config', + ); assert.deepEqual( await captured.subscriptionOptions.getPlanAsync( 'pro',