fix(billing): mock billing admin config in auth bootstrap tests
Memind CI / Test, build, and release guards (pull_request) Successful in 7m24s
Memind CI / Test, build, and release guards (pull_request) Successful in 7m24s
Portal canary source guards were failing because bootstrap tests used a stub pool without query. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user