2026-08-12 08:57:09 +00:00
|
|
|
import { describe, expect, test } from 'bun:test';
|
|
|
|
|
import type { I18nKey } from '@/lib/i18n/store';
|
|
|
|
|
import { buildSettingsSearchResults } from './search';
|
|
|
|
|
|
|
|
|
|
const t = (key: I18nKey): string => key;
|
|
|
|
|
|
|
|
|
|
const runtimeCtx = {
|
|
|
|
|
isVSCode: false,
|
|
|
|
|
isWeb: true,
|
|
|
|
|
isDesktop: false,
|
|
|
|
|
isMobile: false,
|
|
|
|
|
isDesktopLocalOrigin: false,
|
|
|
|
|
isMac: false,
|
|
|
|
|
isWindows: false,
|
|
|
|
|
isLinux: false,
|
|
|
|
|
isWindowsArm64: false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
describe('settings search', () => {
|
|
|
|
|
test('finds the Claude Code third-party integration', () => {
|
|
|
|
|
const results = buildSettingsSearchResults({
|
|
|
|
|
query: 'claude',
|
|
|
|
|
runtimeCtx,
|
|
|
|
|
t,
|
|
|
|
|
getPageTitle: (page) => page,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.third-party.opencode-claude')).toBe(true);
|
|
|
|
|
});
|
2026-08-12 10:14:20 +00:00
|
|
|
|
2026-08-13 16:08:28 +03:00
|
|
|
test('finds third-party integrations by OpenChamber npm package names', () => {
|
|
|
|
|
const results = buildSettingsSearchResults({
|
|
|
|
|
query: '@openchamber/opencode-cursor',
|
|
|
|
|
runtimeCtx,
|
|
|
|
|
t,
|
|
|
|
|
getPageTitle: (page) => page,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.third-party.opencode-cursor-oauth')).toBe(true);
|
|
|
|
|
});
|
2026-08-30 02:18:40 +03:00
|
|
|
|
|
|
|
|
test('finds Linear connect on the integrations page', () => {
|
|
|
|
|
const results = buildSettingsSearchResults({
|
|
|
|
|
query: 'linear',
|
|
|
|
|
runtimeCtx,
|
|
|
|
|
t,
|
|
|
|
|
getPageTitle: (page) => page,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear')).toBe(true);
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear.add-workspace')).toBe(true);
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear.mapping')).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('hides Linear connect in VS Code', () => {
|
|
|
|
|
const results = buildSettingsSearchResults({
|
|
|
|
|
query: 'linear',
|
|
|
|
|
runtimeCtx: { ...runtimeCtx, isVSCode: true },
|
|
|
|
|
t,
|
|
|
|
|
getPageTitle: (page) => page,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear')).toBe(false);
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear.add-workspace')).toBe(false);
|
|
|
|
|
expect(results.some((result) => result.id === 'integrations.linear.mapping')).toBe(false);
|
|
|
|
|
});
|
2026-08-12 08:57:09 +00:00
|
|
|
});
|