Merge pull request 'fix(billing): mock billing admin config in auth bootstrap tests' (#45) from fix/billing-admin-config-bootstrap-tests into main
Memind CI / Test, build, and release guards (push) Successful in 4m9s

This commit was merged in pull request #45.
This commit is contained in:
2026-08-06 09:08:17 +00:00
+22 -1
View File
@@ -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',