🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { describe, expect, it } from 'vitest';
import { LAB_FEATURES } from '@/features/Settings/labs/features';
import { SettingsTabs } from '@/store/global/initialState';
import {
SETTINGS_SEARCH_ITEMS,
type SettingsSearchContext,
TAB_SEARCH_EN_KEYWORDS,
TAB_SEARCH_KEYWORDS_KEYS,
} from './items';
const webContext: SettingsSearchContext = {
disableEmailPassword: false,
enableBusinessFeatures: true,
enableChannels: false,
enableComposio: true,
enableGatewayMode: true,
hasEmail: true,
hideDocs: false,
isDesktop: false,
isLogin: true,
isMobile: false,
isWindows: false,
showAiImage: true,
};
describe('settings search index', () => {
it('only exposes the channel decision setting when channels are enabled', () => {
const item = SETTINGS_SEARCH_ITEMS.find(
(entry) => entry.labelKey === 'systemAgent.channelRouting.title',
)!;
expect(item.visible?.({ ...webContext, enableChannels: false }) ?? true).toBe(false);
expect(item.visible?.({ ...webContext, enableChannels: true }) ?? true).toBe(true);
});
it('indexes the conversation settings under the Conversation tab only', () => {
const conversationLabels = [
'settingCommon.responseLanguage.title',
'hotkey.sendMessage.title',
'settingConversation.voiceMessage.title',
'settingChatAppearance.fontSize.title',
'systemAgent.followUpAction.title',
'systemAgent.inputCompletion.title',
];
for (const labelKey of conversationLabels) {
const tabs = SETTINGS_SEARCH_ITEMS.filter((item) => item.labelKey === labelKey).map(
(item) => item.tab,
);
expect(tabs, labelKey).toEqual([SettingsTabs.Conversation]);
}
});
it('hides the send-key choice on the mobile surface', () => {
const item = SETTINGS_SEARCH_ITEMS.find((entry) => entry.anchor === 'conversation-send-key')!;
expect(item.visible?.(webContext) ?? true).toBe(true);
expect(item.visible?.({ ...webContext, isMobile: true }) ?? true).toBe(false);
});
it('derives one search item per lab feature in catalog order', () => {
const labsItems = SETTINGS_SEARCH_ITEMS.filter((item) => item.tab === SettingsTabs.Labs);
expect(labsItems.map((item) => item.anchor)).toEqual(
LAB_FEATURES.map(({ flag }) => `labs-${flag}`),
);
});
it('hides desktop-only lab features from web search results', () => {
const labsItems = SETTINGS_SEARCH_ITEMS.filter((item) => item.tab === SettingsTabs.Labs);
for (const feature of LAB_FEATURES) {
const item = labsItems.find(({ anchor }) => anchor === `labs-${feature.flag}`)!;
expect(item.visible?.(webContext) ?? true).toBe(!feature.desktopOnly);
}
});
it('offers Codex App Server in web settings search for connected-device runs', () => {
const item = SETTINGS_SEARCH_ITEMS.find(
(entry) => entry.anchor === 'labs-enableCodexAppServer',
);
expect(item).toBeDefined();
expect(item!.visible?.(webContext) ?? true).toBe(true);
});
it('shows workspace lab features exactly where business features are enabled', () => {
const labsItems = SETTINGS_SEARCH_ITEMS.filter((item) => item.tab === SettingsTabs.Labs);
const workspaceItems = LAB_FEATURES.filter((feature) => feature.workspaceOnly).map(({ flag }) =>
labsItems.find(({ anchor }) => anchor === `labs-${flag}`)!,
);
for (const item of workspaceItems) {
expect(item.visible?.(webContext)).toBe(true);
expect(item.visible?.({ ...webContext, enableBusinessFeatures: false })).toBe(false);
}
});
it('indexes the inbox notification channel', () => {
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.anchor === 'notification-inbox')).toBe(true);
});
it('does not offer the retired TTS setting in search', () => {
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.anchor === 'service-model-tts')).toBe(false);
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.ServiceModel]).not.toContain('tts');
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.ServiceModel]).not.toContain('tts settings');
});
it('keeps an English floor for labs and oauth apps tabs', () => {
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Labs]).toContain('experiment');
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.OAuthApps]).toContain('oauth');
expect(TAB_SEARCH_KEYWORDS_KEYS[SettingsTabs.Labs]).toBe('settingsSearch.tabKeywords.labs');
expect(TAB_SEARCH_KEYWORDS_KEYS[SettingsTabs.OAuthApps]).toBe(
'settingsSearch.tabKeywords.oauthApps',
);
});
it('covers the high-volume zero-result phrases as tab keywords', () => {
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Provider]).toEqual(
expect.arrayContaining(['api', 'model provider', 'language model', 'custom provider']),
);
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.ServiceModel]).toEqual(
expect.arrayContaining(['search', 'model assignment']),
);
expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Storage]).toEqual(
expect.arrayContaining(['knowledge base']),
);
});
});
describe('settings search after the Marketplace migration', () => {
// Skills and connectors moved to the Marketplace; searching settings for them
// must not offer a result that opens a settings tab that no longer exists.
it('indexes no skill or connector tab', () => {
for (const tab of [SettingsTabs.Skill, SettingsTabs.Connector]) {
expect(TAB_SEARCH_EN_KEYWORDS[tab]).toBeUndefined();
expect(TAB_SEARCH_KEYWORDS_KEYS[tab]).toBeUndefined();
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.tab === tab)).toBe(false);
}
});
});