diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index f592073a..16cd6869 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -9,6 +9,7 @@ export type SourceType = | 'salesforce'; export interface Source { + id: string; type: SourceType; data?: { url?: string; diff --git a/packages/react/src/chat/ChatView.test.tsx b/packages/react/src/chat/ChatView.test.tsx index 1ca958ca..53879a85 100644 --- a/packages/react/src/chat/ChatView.test.tsx +++ b/packages/react/src/chat/ChatView.test.tsx @@ -520,7 +520,10 @@ describe('ChatView', () => { response = [{ content: 'answer' }]; const references = [ { - file: { path: '/page1', source: { type: 'file-upload' as const } }, + file: { + path: '/page1', + source: { id: '0', type: 'file-upload' as const }, + }, meta: { leadHeading: { value: 'Page 1' } }, }, ]; @@ -542,7 +545,10 @@ describe('ChatView', () => { response = [{ content: 'answer' }]; const references = [ { - file: { path: '/page1', source: { type: 'file-upload' as const } }, + file: { + path: '/page1', + source: { id: '0', type: 'file-upload' as const }, + }, meta: { leadHeading: { value: 'Page 1' } }, }, ]; @@ -569,7 +575,10 @@ describe('ChatView', () => { response = [{ content: 'answer' }]; const references = [ { - file: { path: '/page1', source: { type: 'file-upload' as const } }, + file: { + path: '/page1', + source: { id: '0', type: 'file-upload' as const }, + }, meta: { leadHeading: { value: 'Page 1' } }, }, ]; diff --git a/packages/react/src/constants.test.ts b/packages/react/src/constants.test.ts index d029c7b3..0b58b658 100644 --- a/packages/react/src/constants.test.ts +++ b/packages/react/src/constants.test.ts @@ -14,8 +14,8 @@ const heading = 'Heading 1'; const headingSlug = 'heading-1'; const headingId = 'generated-id'; const noTitleFileName = 'no-title'; -const githubSource: Source = { type: 'github' }; -const websiteSource: Source = { type: 'website' }; +const githubSource: Source = { id: '0', type: 'github' }; +const websiteSource: Source = { id: '0', type: 'website' }; const shortContent = 'Some content'; const loremIpsum = diff --git a/packages/react/src/primitives/headless.test.tsx b/packages/react/src/primitives/headless.test.tsx index 66a78ee8..f9eb1dcc 100644 --- a/packages/react/src/primitives/headless.test.tsx +++ b/packages/react/src/primitives/headless.test.tsx @@ -240,7 +240,9 @@ test('References renders the passed ReferenceComponent', () => { render( , diff --git a/packages/react/src/search/SearchView.test.tsx b/packages/react/src/search/SearchView.test.tsx index 646ff42f..f70b2685 100644 --- a/packages/react/src/search/SearchView.test.tsx +++ b/packages/react/src/search/SearchView.test.tsx @@ -81,14 +81,17 @@ describe('SearchView', () => { results = [ { - file: { path: 'path/to/file', source: { type: 'github' } }, + file: { + path: 'path/to/file', + source: { id: '0', type: 'github' }, + }, matchType: 'title', }, { file: { path: 'path/to/file', title: 'result 1', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'title', }, @@ -96,7 +99,7 @@ describe('SearchView', () => { file: { path: 'path/to/file', title: 'result 2', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'title', meta: { @@ -108,7 +111,7 @@ describe('SearchView', () => { { file: { path: 'path/to/file', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'leadHeading', meta: { @@ -121,7 +124,7 @@ describe('SearchView', () => { { file: { path: 'path/to/file', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, meta: { leadHeading: { @@ -177,14 +180,17 @@ describe('SearchView', () => { results = [ { - file: { path: 'path/to/file', source: { type: 'github' } }, + file: { + path: 'path/to/file', + source: { id: '0', type: 'github' }, + }, matchType: 'title', }, { file: { path: 'path/to/file', title: 'result 1', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'title', }, @@ -192,7 +198,7 @@ describe('SearchView', () => { file: { path: 'path/to/file', title: 'result 2', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'title', meta: { @@ -265,7 +271,10 @@ describe('SearchView', () => { results = [ { - file: { path: 'path/to/file', source: { type: 'github' } }, + file: { + path: 'path/to/file', + source: { id: '0', type: 'github' }, + }, matchType: 'title', }, ]; @@ -300,7 +309,10 @@ describe('SearchView', () => { results = [ { - file: { path: '#file', source: { type: 'github' } }, + file: { + path: '#file', + source: { id: '0', type: 'github' }, + }, matchType: 'title', }, ]; @@ -330,7 +342,7 @@ describe('SearchView', () => { file: { path: 'path/to/file', title: 'test', - source: { type: 'github' }, + source: { id: '0', type: 'github' }, }, matchType: 'title', }, @@ -414,7 +426,10 @@ describe('SearchView', () => { results = [ { - file: { path: 'path/to/file', source: { type: 'github' } }, + file: { + path: 'path/to/file', + source: { id: '0', type: 'github' }, + }, matchType: 'title', }, ]; diff --git a/packages/react/src/search/useSearch.test.ts b/packages/react/src/search/useSearch.test.ts index 4a8ae94c..7cdaac4a 100644 --- a/packages/react/src/search/useSearch.test.ts +++ b/packages/react/src/search/useSearch.test.ts @@ -82,6 +82,7 @@ describe('useSearch', () => { title: 'Home page', path: '/', source: { + id: '0', type: 'file-upload', }, }, @@ -91,6 +92,7 @@ describe('useSearch', () => { file: { path: '/page1', source: { + id: '0', type: 'file-upload', }, }, @@ -104,6 +106,7 @@ describe('useSearch', () => { file: { path: '/page2', source: { + id: '0', type: 'file-upload', }, },