test(portal): mock template catalog bootstrap in auth service tests
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:
john
2026-08-10 09:36:51 +08:00
parent c3e6d4ee31
commit 943dad5221
+22 -8
View File
@@ -22,6 +22,7 @@ function createSetup(overrides = {}) {
}; };
const wechatOAuthService = { enabled: true }; const wechatOAuthService = { enabled: true };
const rechargeService = { id: 'recharge' }; const rechargeService = { id: 'recharge' };
const templateCatalogService = { id: 'template-catalog' };
let subscriptionOptions; let subscriptionOptions;
let userAuthOptions; let userAuthOptions;
let sessionAccessOptions; let sessionAccessOptions;
@@ -51,11 +52,25 @@ function createSetup(overrides = {}) {
assert.equal(receivedPool, pool); assert.equal(receivedPool, pool);
calls.push(['plan-schema']); calls.push(['plan-schema']);
}, },
async ensureTemplateCatalogSchemaFn(receivedPool) {
assert.equal(receivedPool, pool);
calls.push(['template-schema']);
},
createPlanCatalogServiceFn(receivedPool) { createPlanCatalogServiceFn(receivedPool) {
assert.equal(receivedPool, pool); assert.equal(receivedPool, pool);
calls.push(['plan-service']); calls.push(['plan-service']);
return planCatalogService; return planCatalogService;
}, },
createPageTemplateCatalogServiceFn(receivedPool) {
assert.equal(receivedPool, pool);
calls.push(['template-service']);
return {
...templateCatalogService,
async ensureReady() {
calls.push(['template-ready']);
},
};
},
createSubscriptionServiceFn( createSubscriptionServiceFn(
receivedPool, receivedPool,
receivedOptions, receivedOptions,
@@ -147,6 +162,7 @@ function createSetup(overrides = {}) {
wechatPayClient, wechatPayClient,
wechatOAuthService, wechatOAuthService,
rechargeService, rechargeService,
templateCatalogService,
getCaptured() { getCaptured() {
return { return {
subscriptionOptions, subscriptionOptions,
@@ -175,9 +191,10 @@ 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, 6).map(([name]) => name), setup.calls.slice(0, 7).map(([name]) => name),
[ [
'plan-schema', 'plan-schema',
'template-schema',
'plan-service', 'plan-service',
'subscription-service', 'subscription-service',
'billing-config', 'billing-config',
@@ -281,13 +298,10 @@ test('preserves WeChat and recharge service wiring and logs', async () => {
{ appId: 'app-id' }, { appId: 'app-id' },
{ userAuth: setup.userAuth }, { userAuth: setup.userAuth },
]); ]);
assert.deepEqual(captured.rechargeArgs, [ assert.equal(captured.rechargeArgs?.[0], setup.pool);
setup.pool, assert.equal(captured.rechargeArgs?.[1]?.userAuth, setup.userAuth);
{ assert.equal(captured.rechargeArgs?.[1]?.wechatPay, setup.wechatPayClient);
userAuth: setup.userAuth, assert.equal(captured.rechargeArgs?.[1]?.templateCatalogService?.id, 'template-catalog');
wechatPay: setup.wechatPayClient,
},
]);
assert.equal( assert.equal(
result.wechatOAuthService, result.wechatOAuthService,
setup.wechatOAuthService, setup.wechatOAuthService,