fix: lock IM tenant to default

This commit is contained in:
richjohnrambo
2026-10-19 11:28:07 +08:00
parent 72c4f4e54d
commit c063d056b2
4 changed files with 41 additions and 19 deletions
+24
View File
@@ -0,0 +1,24 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
const source = (path) => readFile(new URL(`../${path}`, import.meta.url), 'utf8');
test('tenant entry is permanently fixed to default', async () => {
const config = await source('src/lib/config.ts');
const entry = await source('src/features/auth/TenantEntryPage.tsx');
assert.match(config, /FIXED_TENANT_CODE = 'default'/);
assert.match(entry, /value=\{FIXED_TENANT_CODE\}/);
assert.match(entry, /readOnly/);
assert.match(entry, /resolveTenant\(FIXED_TENANT_CODE\)/);
assert.doesNotMatch(entry, /setCode/);
});
test('login page exposes no tenant switch and rejects stale tenant state', async () => {
const login = await source('src/features/auth/LoginPage.tsx');
assert.match(login, /tenant\.code !== FIXED_TENANT_CODE/);
assert.match(login, /企业码:\{FIXED_TENANT_CODE\}/);
assert.doesNotMatch(login, />\s*切换企业\s*</);
});