mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 04:40:57 +00:00
style(web): format support admin session changes
This commit is contained in:
@@ -157,10 +157,7 @@ export default function HomeLayout({
|
|||||||
// selected Workspace's wizard state.
|
// selected Workspace's wizard state.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!identityReady) return;
|
if (!identityReady) return;
|
||||||
if (
|
if (systemInfo?.wizard_status === 'none' && !isSupportAdminSession()) {
|
||||||
systemInfo?.wizard_status === 'none' &&
|
|
||||||
!isSupportAdminSession()
|
|
||||||
) {
|
|
||||||
navigate('/wizard', { replace: true });
|
navigate('/wizard', { replace: true });
|
||||||
}
|
}
|
||||||
}, [identityReady, navigate]);
|
}, [identityReady, navigate]);
|
||||||
|
|||||||
@@ -4,22 +4,25 @@ import path from 'node:path';
|
|||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
const root = path.resolve(
|
||||||
|
path.dirname(fileURLToPath(import.meta.url)),
|
||||||
|
'../..',
|
||||||
|
);
|
||||||
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
|
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
|
||||||
|
|
||||||
test('support-admin launch stores a scoped principal instead of starting an Account session', () => {
|
test('support-admin launch stores a scoped principal instead of starting an Account session', () => {
|
||||||
const callback = read('src/app/auth/space/callback/page.tsx');
|
const callback = read('src/app/auth/space/callback/page.tsx');
|
||||||
assert.match(callback, /response\.principal_type === 'support_admin'/);
|
assert.match(callback, /response\.principal_type === 'support_admin'/);
|
||||||
assert.match(callback, /beginSupportAdminSession\(response\.token, response\.workspace_uuid\)/);
|
assert.match(
|
||||||
|
callback,
|
||||||
|
/beginSupportAdminSession\(response\.token, response\.workspace_uuid\)/,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('support-admin workspace bootstrap never calls Account bootstrap', () => {
|
test('support-admin workspace bootstrap never calls Account bootstrap', () => {
|
||||||
const source = read('src/app/infra/http/index.ts');
|
const source = read('src/app/infra/http/index.ts');
|
||||||
assert.match(source, /export function beginSupportAdminSession/);
|
assert.match(source, /export function beginSupportAdminSession/);
|
||||||
assert.match(
|
assert.match(source, /export function isSupportAdminSession\(\): boolean/);
|
||||||
source,
|
|
||||||
/export function isSupportAdminSession\(\): boolean/,
|
|
||||||
);
|
|
||||||
const supportBranch = source.indexOf('if (isSupportAdminSession())');
|
const supportBranch = source.indexOf('if (isSupportAdminSession())');
|
||||||
const accountBootstrap = source.indexOf(
|
const accountBootstrap = source.indexOf(
|
||||||
'backendClient.getWorkspaceBootstrap()',
|
'backendClient.getWorkspaceBootstrap()',
|
||||||
|
|||||||
Reference in New Issue
Block a user