Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | import { describe, expect, test } from 'bun:test'; |
| 2 | import * as customSearchDialogModule from '@/components/custom-search-dialog'; |
| 3 | |
| 4 | describe('global search result analytics metadata', () => { |
| 5 | test('skips hits that do not have a navigable URL', () => { |
| 6 | const buildAlgoliaHitMetadata = ( |
| 7 | customSearchDialogModule as { |
| 8 | buildAlgoliaHitMetadata?: ( |
| 9 | hits: Array<{ objectID: string; url?: string }>, |
| 10 | queryID?: string, |
| 11 | ) => Map<string, { objectID: string; position: number; queryID?: string }>; |
| 12 | } |
| 13 | ).buildAlgoliaHitMetadata; |
| 14 | |
| 15 | expect(typeof buildAlgoliaHitMetadata).toBe('function'); |
| 16 | if (!buildAlgoliaHitMetadata) return; |
| 17 | |
| 18 | const metadata = buildAlgoliaHitMetadata([ |
| 19 | { objectID: 'missing-url' }, |
| 20 | { objectID: 'docs', url: '/docs' }, |
| 21 | ], 'query-id'); |
| 22 | |
| 23 | expect([...metadata.entries()]).toEqual([[ |
| 24 | '/docs', |
| 25 | { objectID: 'docs', position: 2, queryID: 'query-id' }, |
| 26 | ]]); |
| 27 | }); |
| 28 | }); |