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;
|
subscriptionOptions = receivedOptions;
|
||||||
return { id: 'subscription' };
|
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) {
|
createUserAuthFn(receivedPool, receivedOptions) {
|
||||||
assert.equal(receivedPool, pool);
|
assert.equal(receivedPool, pool);
|
||||||
calls.push(['user-auth']);
|
calls.push(['user-auth']);
|
||||||
@@ -161,11 +175,13 @@ test('preserves subscription, auth, and user-space wiring', async () => {
|
|||||||
let captured = setup.getCaptured();
|
let captured = setup.getCaptured();
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setup.calls.slice(0, 4).map(([name]) => name),
|
setup.calls.slice(0, 6).map(([name]) => name),
|
||||||
[
|
[
|
||||||
'plan-schema',
|
'plan-schema',
|
||||||
'plan-service',
|
'plan-service',
|
||||||
'subscription-service',
|
'subscription-service',
|
||||||
|
'billing-config',
|
||||||
|
'billing-config-schema',
|
||||||
'user-auth',
|
'user-auth',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -173,6 +189,11 @@ test('preserves subscription, auth, and user-space wiring', async () => {
|
|||||||
result.subscriptionService._planCatalogService,
|
result.subscriptionService._planCatalogService,
|
||||||
setup.planCatalogService,
|
setup.planCatalogService,
|
||||||
);
|
);
|
||||||
|
assert.equal(result.billingConfigService?.id, 'billing-config');
|
||||||
|
assert.equal(
|
||||||
|
captured.userAuthOptions.billingConfigService?.id,
|
||||||
|
'billing-config',
|
||||||
|
);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
await captured.subscriptionOptions.getPlanAsync(
|
await captured.subscriptionOptions.getPlanAsync(
|
||||||
'pro',
|
'pro',
|
||||||
|
|||||||
Reference in New Issue
Block a user