0734cfd319
Opening a plugin/Bot Mode session is navigation, not a workspace switch. keepAllProfilesScope (default true) now dials the named backend without moving $activeGatewayProfile or setApiRequestProfile. Session-owned RPCs still route to the session owner. Pass false to switch chrome and collapse the Sessions sidebar.
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { planPluginOpenSession } from './plugin-open-session-plan'
|
|
|
|
describe('planPluginOpenSession', () => {
|
|
it('defaults to navigation: dial the worker, do not steal chrome', () => {
|
|
const plan = planPluginOpenSession({
|
|
activeProfile: 'default',
|
|
profile: 'worker'
|
|
})
|
|
|
|
expect(plan.switchWorkspace).toBeNull()
|
|
expect(plan.dialWithoutSwitching).toBe('worker')
|
|
expect(plan.showAllProfiles).toBe(true)
|
|
expect(plan.requireActiveProfileForHydration).toBe(false)
|
|
})
|
|
|
|
it('does not steal chrome even when keepAllProfilesScope is explicitly true', () => {
|
|
const plan = planPluginOpenSession({
|
|
activeProfile: 'default',
|
|
keepAllProfilesScope: true,
|
|
profile: 'worker'
|
|
})
|
|
|
|
expect(plan.switchWorkspace).toBeNull()
|
|
expect(plan.dialWithoutSwitching).toBe('worker')
|
|
expect(plan.showAllProfiles).toBe(true)
|
|
expect(plan.requireActiveProfileForHydration).toBe(false)
|
|
})
|
|
|
|
it('does not re-dial when chrome is already on that profile', () => {
|
|
const plan = planPluginOpenSession({
|
|
activeProfile: 'worker',
|
|
keepAllProfilesScope: true,
|
|
profile: 'worker'
|
|
})
|
|
|
|
expect(plan.switchWorkspace).toBeNull()
|
|
expect(plan.dialWithoutSwitching).toBeNull()
|
|
// Still restores the unified list: re-opening an already-live bot must not
|
|
// leave Sessions collapsed onto a profile whose forever-chat is hidden.
|
|
expect(plan.showAllProfiles).toBe(true)
|
|
})
|
|
|
|
it('treats keepAllProfilesScope:false as an explicit workspace switch', () => {
|
|
const plan = planPluginOpenSession({
|
|
activeProfile: 'default',
|
|
keepAllProfilesScope: false,
|
|
profile: 'worker'
|
|
})
|
|
|
|
expect(plan.switchWorkspace).toBe('worker')
|
|
expect(plan.dialWithoutSwitching).toBeNull()
|
|
expect(plan.showAllProfiles).toBe(false)
|
|
expect(plan.requireActiveProfileForHydration).toBe(true)
|
|
})
|
|
|
|
it('treats an empty profile as neither a dial nor a workspace switch', () => {
|
|
const plan = planPluginOpenSession({
|
|
activeProfile: 'default',
|
|
keepAllProfilesScope: true,
|
|
profile: ' '
|
|
})
|
|
|
|
expect(plan.switchWorkspace).toBeNull()
|
|
expect(plan.dialWithoutSwitching).toBeNull()
|
|
expect(plan.showAllProfiles).toBeNull()
|
|
})
|
|
})
|