一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
35 行
1.5 KiB
TypeScript
35 行
1.5 KiB
TypeScript
import { normalizeQuery, hasNormalizedQuery, toSearchText, shouldShowBySearch, equalsNormalizedQuery, includesNormalizedQuery } from './config-search-text';
|
|
|
|
describe('config-search', () => {
|
|
it('should normalize query for case-insensitive matching', () => {
|
|
expect(normalizeQuery(' SyNc ')).toBe('sync');
|
|
expect(normalizeQuery('\t\n')).toBe('');
|
|
});
|
|
|
|
it('should provide normalized query matching helpers', () => {
|
|
expect(hasNormalizedQuery(' ')).toBe(false);
|
|
expect(hasNormalizedQuery(' sync ')).toBe(true);
|
|
|
|
expect(equalsNormalizedQuery(' General ', 'general')).toBe(true);
|
|
expect(equalsNormalizedQuery(' General ', 'generally')).toBe(false);
|
|
|
|
expect(includesNormalizedQuery('sync', 'Synchronization interval')).toBe(true);
|
|
expect(includesNormalizedQuery('sync', 'General settings')).toBe(false);
|
|
});
|
|
|
|
it('should normalize related text inputs', () => {
|
|
expect(toSearchText('alpha')).toBe('alpha');
|
|
expect(toSearchText(['alpha', 'beta'])).toBe('alpha\nbeta');
|
|
expect(toSearchText(null)).toBe('');
|
|
expect(toSearchText(undefined)).toBe('');
|
|
});
|
|
|
|
it('should apply shared visibility predicate', () => {
|
|
expect(shouldShowBySearch('general', 'General', 'other value')).toBe(true);
|
|
expect(shouldShowBySearch('sync', 'General', 'Synchronization interval')).toBe(true);
|
|
expect(shouldShowBySearch(' ', 'General', 'Synchronization interval')).toBe(false);
|
|
expect(shouldShowBySearch('sync', 'General', 'No match here')).toBe(false);
|
|
expect(shouldShowBySearch('sync', 'General', ['Synchronization', 'other'])).toBe(true);
|
|
});
|
|
});
|