test(portal): mock template catalog bootstrap in auth service tests
Memind CI / Test, build, and release guards (push) Failing after 7m56s
Memind CI / Test, build, and release guards (push) Failing after 7m56s
Fix canary release source guards that match publish|space|billing tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,7 @@ function createSetup(overrides = {}) {
|
||||
};
|
||||
const wechatOAuthService = { enabled: true };
|
||||
const rechargeService = { id: 'recharge' };
|
||||
const templateCatalogService = { id: 'template-catalog' };
|
||||
let subscriptionOptions;
|
||||
let userAuthOptions;
|
||||
let sessionAccessOptions;
|
||||
@@ -51,11 +52,25 @@ function createSetup(overrides = {}) {
|
||||
assert.equal(receivedPool, pool);
|
||||
calls.push(['plan-schema']);
|
||||
},
|
||||
async ensureTemplateCatalogSchemaFn(receivedPool) {
|
||||
assert.equal(receivedPool, pool);
|
||||
calls.push(['template-schema']);
|
||||
},
|
||||
createPlanCatalogServiceFn(receivedPool) {
|
||||
assert.equal(receivedPool, pool);
|
||||
calls.push(['plan-service']);
|
||||
return planCatalogService;
|
||||
},
|
||||
createPageTemplateCatalogServiceFn(receivedPool) {
|
||||
assert.equal(receivedPool, pool);
|
||||
calls.push(['template-service']);
|
||||
return {
|
||||
...templateCatalogService,
|
||||
async ensureReady() {
|
||||
calls.push(['template-ready']);
|
||||
},
|
||||
};
|
||||
},
|
||||
createSubscriptionServiceFn(
|
||||
receivedPool,
|
||||
receivedOptions,
|
||||
@@ -147,6 +162,7 @@ function createSetup(overrides = {}) {
|
||||
wechatPayClient,
|
||||
wechatOAuthService,
|
||||
rechargeService,
|
||||
templateCatalogService,
|
||||
getCaptured() {
|
||||
return {
|
||||
subscriptionOptions,
|
||||
@@ -175,9 +191,10 @@ test('preserves subscription, auth, and user-space wiring', async () => {
|
||||
let captured = setup.getCaptured();
|
||||
|
||||
assert.deepEqual(
|
||||
setup.calls.slice(0, 6).map(([name]) => name),
|
||||
setup.calls.slice(0, 7).map(([name]) => name),
|
||||
[
|
||||
'plan-schema',
|
||||
'template-schema',
|
||||
'plan-service',
|
||||
'subscription-service',
|
||||
'billing-config',
|
||||
@@ -281,13 +298,10 @@ test('preserves WeChat and recharge service wiring and logs', async () => {
|
||||
{ appId: 'app-id' },
|
||||
{ userAuth: setup.userAuth },
|
||||
]);
|
||||
assert.deepEqual(captured.rechargeArgs, [
|
||||
setup.pool,
|
||||
{
|
||||
userAuth: setup.userAuth,
|
||||
wechatPay: setup.wechatPayClient,
|
||||
},
|
||||
]);
|
||||
assert.equal(captured.rechargeArgs?.[0], setup.pool);
|
||||
assert.equal(captured.rechargeArgs?.[1]?.userAuth, setup.userAuth);
|
||||
assert.equal(captured.rechargeArgs?.[1]?.wechatPay, setup.wechatPayClient);
|
||||
assert.equal(captured.rechargeArgs?.[1]?.templateCatalogService?.id, 'template-catalog');
|
||||
assert.equal(
|
||||
result.wechatOAuthService,
|
||||
setup.wechatOAuthService,
|
||||
|
||||
Reference in New Issue
Block a user