@tambo-ai/react 0.50.0 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/__tests__/use-component-state.test.js +4 -1
- package/dist/hooks/__tests__/use-component-state.test.js.map +1 -1
- package/dist/hooks/__tests__/use-tambo-threads.test.js +1 -1
- package/dist/hooks/__tests__/use-tambo-threads.test.js.map +1 -1
- package/dist/hooks/use-component-state.js +3 -3
- package/dist/hooks/use-component-state.js.map +1 -1
- package/dist/hooks/use-suggestions.js +4 -2
- package/dist/hooks/use-suggestions.js.map +1 -1
- package/dist/mcp/__tests__/mcp-client.test.d.ts +2 -0
- package/dist/mcp/__tests__/mcp-client.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/mcp-client.test.js +502 -0
- package/dist/mcp/__tests__/mcp-client.test.js.map +1 -0
- package/dist/mcp/mcp-client.d.ts +77 -3
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +184 -19
- package/dist/mcp/mcp-client.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts +1 -0
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +1 -0
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/model/tambo-interactable.d.ts +1 -1
- package/dist/model/tambo-interactable.d.ts.map +1 -1
- package/dist/model/tambo-interactable.js.map +1 -1
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.d.ts +2 -0
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.d.ts.map +1 -0
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.js +677 -0
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.js.map +1 -0
- package/dist/providers/__tests__/tambo-stubs.test.js +6 -2
- package/dist/providers/__tests__/tambo-stubs.test.js.map +1 -1
- package/dist/providers/__tests__/tambo-thread-provider.test.js +98 -14
- package/dist/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/dist/providers/tambo-interactable-provider.js +26 -24
- package/dist/providers/tambo-interactable-provider.js.map +1 -1
- package/dist/providers/tambo-provider.d.ts +1 -0
- package/dist/providers/tambo-provider.d.ts.map +1 -1
- package/dist/providers/tambo-provider.js +1 -0
- package/dist/providers/tambo-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js +44 -5
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.d.ts.map +1 -1
- package/dist/setupTests.js +0 -1
- package/dist/setupTests.js.map +1 -1
- package/esm/hooks/__tests__/use-component-state.test.js +4 -1
- package/esm/hooks/__tests__/use-component-state.test.js.map +1 -1
- package/esm/hooks/__tests__/use-tambo-threads.test.js +1 -1
- package/esm/hooks/__tests__/use-tambo-threads.test.js.map +1 -1
- package/esm/hooks/use-component-state.js +3 -3
- package/esm/hooks/use-component-state.js.map +1 -1
- package/esm/hooks/use-suggestions.js +4 -2
- package/esm/hooks/use-suggestions.js.map +1 -1
- package/esm/mcp/__tests__/mcp-client.test.d.ts +2 -0
- package/esm/mcp/__tests__/mcp-client.test.d.ts.map +1 -0
- package/esm/mcp/__tests__/mcp-client.test.js +500 -0
- package/esm/mcp/__tests__/mcp-client.test.js.map +1 -0
- package/esm/mcp/mcp-client.d.ts +77 -3
- package/esm/mcp/mcp-client.d.ts.map +1 -1
- package/esm/mcp/mcp-client.js +184 -19
- package/esm/mcp/mcp-client.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts +1 -0
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +1 -0
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/model/tambo-interactable.d.ts +1 -1
- package/esm/model/tambo-interactable.d.ts.map +1 -1
- package/esm/model/tambo-interactable.js.map +1 -1
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.d.ts +2 -0
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.d.ts.map +1 -0
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.js +672 -0
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.js.map +1 -0
- package/esm/providers/__tests__/tambo-stubs.test.js +6 -2
- package/esm/providers/__tests__/tambo-stubs.test.js.map +1 -1
- package/esm/providers/__tests__/tambo-thread-provider.test.js +99 -15
- package/esm/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/esm/providers/tambo-interactable-provider.js +26 -24
- package/esm/providers/tambo-interactable-provider.js.map +1 -1
- package/esm/providers/tambo-provider.d.ts +1 -0
- package/esm/providers/tambo-provider.d.ts.map +1 -1
- package/esm/providers/tambo-provider.js +1 -0
- package/esm/providers/tambo-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js +45 -6
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/setupTests.d.ts +0 -1
- package/esm/setupTests.d.ts.map +1 -1
- package/esm/setupTests.js +0 -1
- package/esm/setupTests.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tambo-interactable-provider-partial-updates.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-interactable-provider-partial-updates.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyD;AACzD,kDAA0B;AAC1B,6BAAwB;AAExB,gFAGwC;AAExC,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACvC,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE1C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE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AO,EAAE;6BACnB,CAAC;yBACH,CAAC;qBACH,CAAC;iBACH,CAAC;aACH,CAAC;YAEF,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAA,WAAG,EAAC,GAAG,EAAE;gBACP,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;YAEH,8EAA8E;YAC9E,IAAA,WAAG,EAAC,GAAG,EAAE;gBACP,MAAM,CAAC,OAAO,CAAC,gCAAgC,CAAC,WAAW,EAAE;oBAC3D,MAAM,EAAE;wBACN,QAAQ,EAAE;4BACR,YAAY,EAAE;gCACZ,IAAI,EAAE,IAAI;gCACV,uDAAuD;gCACvD,+CAA+C;6BAChD;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;gBAC7D,KAAK,EAAE,gBAAgB;gBACvB,MAAM,EAAE;oBACN,4DAA4D;oBAC5D,QAAQ,EAAE;wBACR,qEAAqE;wBACrE,YAAY,EAAE;4BACZ,IAAI,EAAE,IAAI,EAAE,UAAU;4BACtB,8CAA8C;yBAC/C;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { act, renderHook } from \"@testing-library/react\";\nimport React from \"react\";\nimport { z } from \"zod\";\nimport { TamboInteractableComponent } from \"../../model/tambo-interactable\";\nimport {\n TamboInteractableProvider,\n useTamboInteractable,\n} from \"../tambo-interactable-provider\";\n\n// Mock the context helpers\nconst mockAddContextHelper = jest.fn();\nconst mockRemoveContextHelper = jest.fn();\n\njest.mock(\"../tambo-context-helpers-provider\", () => ({\n TamboContextHelpersProvider: ({\n children,\n }: {\n children: React.ReactNode;\n }) => <>{children}</>,\n useTamboContextHelpers: () => ({\n addContextHelper: mockAddContextHelper,\n removeContextHelper: mockRemoveContextHelper,\n }),\n}));\n\n// Mock the component provider\nconst mockRegisterTool = jest.fn();\n\njest.mock(\"../tambo-component-provider\", () => ({\n useTamboComponent: () => ({\n registerTool: mockRegisterTool,\n }),\n}));\n\n// Mock the context helper creation\njest.mock(\"../../context-helpers/current-interactables-context-helper\", () => ({\n createInteractablesContextHelper: () =>\n jest.fn(() => ({\n name: \"interactables\",\n context: {\n description: \"Test interactables context\",\n components: [],\n },\n })),\n}));\n\ndescribe(\"updateInteractableComponentProps - Partial Updates\", () => {\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboInteractableProvider>{children}</TamboInteractableProvider>\n );\n\n describe(\"Partial Updates Functionality\", () => {\n it(\"should apply partial updates to existing props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Verify initial state\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n });\n\n // Apply partial update - only change count\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n count: 5,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n count: 5, // updated\n active: true, // unchanged\n metadata: { type: \"test\", version: \"1.0\" }, // unchanged\n });\n });\n\n it(\"should apply multiple partial updates in sequence\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // First partial update - change title and count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n title: \"Updated Title\",\n count: 10,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\",\n count: 10,\n active: true,\n description: \"Original description\",\n });\n\n // Second partial update - change active and description\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n active: false,\n description: \"Updated description\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\", // from previous update\n count: 10, // from previous update\n active: false, // new update\n description: \"Updated description\", // new update\n });\n });\n\n it(\"should handle nested object partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - replace entire config object (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"dark\",\n // Note: language and features are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"dark\", // updated\n // language and features are now undefined due to shallow merge\n },\n });\n });\n\n it(\"should handle array partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n items: [\"item1\", \"item2\", \"item3\"],\n tags: [\"tag1\", \"tag2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n items: z.array(z.string()),\n tags: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - only change items array\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n items: [\"newItem1\", \"newItem2\"],\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n items: [\"newItem1\", \"newItem2\"], // updated\n tags: [\"tag1\", \"tag2\"], // unchanged\n });\n });\n\n it(\"should handle null and undefined values in partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update with null value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n description: null as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 5,\n description: null,\n });\n\n // Partial update with undefined value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: undefined as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: undefined,\n description: null,\n });\n });\n });\n\n describe(\"Error Handling\", () => {\n it(\"should return error for non-existent component\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n \"non-existent\",\n {\n title: \"New Title\",\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n });\n\n it(\"should return warning for empty props object\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {},\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for null props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n null as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for undefined props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n undefined as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n });\n\n describe(\"Performance and Efficiency\", () => {\n it(\"should only update changed properties without affecting others\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n items: [\"item1\", \"item2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n items: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalMetadata = originalProps.metadata;\n const originalItems = originalProps.items;\n\n // Apply minimal partial update - only change count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: 1,\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify that only count changed\n expect(updatedProps.count).toBe(1);\n expect(updatedProps.title).toBe(\"Original Title\");\n expect(updatedProps.active).toBe(true);\n\n // Verify that nested objects are preserved (same reference for efficiency)\n expect(updatedProps.metadata).toBe(originalMetadata);\n expect(updatedProps.items).toBe(originalItems);\n });\n\n it(\"should handle large objects efficiently with partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n // Create a component with a large initial state\n const largeData = {\n users: Array.from({ length: 1000 }, (_, i) => ({\n id: i,\n name: `User ${i}`,\n })),\n settings: {\n theme: \"light\",\n language: \"en\",\n notifications: true,\n privacy: {\n shareData: false,\n analytics: true,\n marketing: false,\n },\n },\n metadata: {\n version: \"1.0.0\",\n build: \"12345\",\n timestamp: Date.now(),\n },\n };\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component with large data\",\n component: () => <div>Test</div>,\n props: largeData,\n propsSchema: z.object({\n users: z.array(\n z.object({\n id: z.number(),\n name: z.string(),\n }),\n ),\n settings: z.object({\n theme: z.string(),\n language: z.string(),\n notifications: z.boolean(),\n privacy: z.object({\n shareData: z.boolean(),\n analytics: z.boolean(),\n marketing: z.boolean(),\n }),\n }),\n metadata: z.object({\n version: z.string(),\n build: z.string(),\n timestamp: z.number(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalUsers = originalProps.users;\n\n // Apply a small partial update - only change theme (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n settings: {\n theme: \"dark\",\n // Note: other settings properties are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify the update worked\n expect(updatedProps.settings.theme).toBe(\"dark\");\n // Due to shallow merge, other properties are now undefined\n expect(updatedProps.settings.language).toBeUndefined();\n expect(updatedProps.settings.notifications).toBeUndefined();\n\n // Verify that large arrays are preserved (same reference for efficiency)\n expect(updatedProps.users).toBe(originalUsers);\n\n // Verify that metadata is preserved (not updated)\n expect(updatedProps.metadata).toBe(originalProps.metadata);\n });\n });\n\n describe(\"Edge Cases\", () => {\n it(\"should handle updating a property that doesn't exist in original props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n newProperty: z.string().optional(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Add a new property that wasn't in the original props\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n newProperty: \"New Value\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n newProperty: \"New Value\",\n });\n });\n\n it(\"should handle updating with same values (no-op updates)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n\n // Update with the same values\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual(\n originalProps,\n );\n });\n\n it(\"should handle proper nested partial updates by providing complete nested structure\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Proper nested partial update - provide complete nested structure\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"light\", // keep original\n language: \"en\", // keep original\n features: {\n notifications: true, // keep original\n analytics: false, // keep original\n experimental: {\n beta: true, // update this\n alpha: true, // keep original\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"light\", // unchanged\n language: \"en\", // unchanged\n features: {\n notifications: true, // unchanged\n analytics: false, // unchanged\n experimental: {\n beta: true, // updated\n alpha: true, // unchanged\n },\n },\n },\n });\n });\n\n it(\"should handle complex nested partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Deep nested partial update - only change beta flag (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n features: {\n experimental: {\n beta: true,\n // Note: alpha is not provided, so it will be undefined\n // This demonstrates the shallow merge behavior\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n // theme and language are now undefined due to shallow merge\n features: {\n // notifications and analytics are now undefined due to shallow merge\n experimental: {\n beta: true, // updated\n // alpha is now undefined due to shallow merge\n },\n },\n },\n });\n });\n });\n});\n"]}
|
|
@@ -51,8 +51,12 @@ describe("TamboStubProvider threads functionality", () => {
|
|
|
51
51
|
total: 1,
|
|
52
52
|
count: 1,
|
|
53
53
|
getPaginatedItems: () => [mockThread],
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
nextPageRequestOptions: () => ({
|
|
55
|
+
offset: 1,
|
|
56
|
+
limit: 10,
|
|
57
|
+
path: "/threads",
|
|
58
|
+
method: "get",
|
|
59
|
+
}),
|
|
56
60
|
};
|
|
57
61
|
it("should populate query cache with threads data", async () => {
|
|
58
62
|
const wrapper = ({ children }) => (react_2.default.createElement(tambo_stubs_1.TamboStubProvider, { thread: mockThread, threads: mockThreadsData, projectId: "test-project", components: [], tools: [] }, children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-stubs.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-stubs.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoD;AACpD,+CAAmC;AACnC,qEAAmE;AAEnE,gDAAmD;AAEnD,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,MAAM,UAAU,GAAgB;QAC9B,EAAE,EAAE,aAAa;QACjB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,sBAAsB;QACjC,SAAS,EAAE,cAAc;QACzB,SAAS,EAAE,sBAAsB;QACjC,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,MAAM,eAAe,GAAwD;QAC3E,KAAK,EAAE,CAAC,UAAU,CAAC;QACnB,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC;QACrC,
|
|
1
|
+
{"version":3,"file":"tambo-stubs.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-stubs.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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C,EAAE,EAAE,CAAC,CAC/D,8BAAC,+BAAiB,IAChB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,eAAe;YACxB,+DAA+D;YAC/D,UAAU,EAAE,EAAE,EACd,KAAK,EAAE,EAAE,IAER,QAAQ,CACS,CACrB,CAAC;QAEF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,CAAC,IAAA,sCAAkB,GAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACvE,6BAA6B;QAC7B,MAAM,IAAA,WAAG,EAAC,KAAK,IAAI,EAAE;YACnB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,+EAA+E;QAC/E,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { renderHook } from \"@testing-library/react\";\nimport React, { act } from \"react\";\nimport { useTamboThreadList } from \"../../hooks/use-tambo-threads\";\nimport { TamboThread } from \"../../model/tambo-thread\";\nimport { TamboStubProvider } from \"../tambo-stubs\";\n\ndescribe(\"TamboStubProvider threads functionality\", () => {\n const mockThread: TamboThread = {\n id: \"test-thread\",\n messages: [],\n createdAt: \"2024-01-01T00:00:00Z\",\n projectId: \"test-project\",\n updatedAt: \"2024-01-01T00:00:00Z\",\n metadata: {},\n };\n\n const mockThreadsData: Partial<TamboAI.Beta.Threads.ThreadsOffsetAndLimit> = {\n items: [mockThread],\n total: 1,\n count: 1,\n getPaginatedItems: () => [mockThread],\n nextPageRequestOptions: () => ({\n offset: 1,\n limit: 10,\n path: \"/threads\",\n method: \"get\",\n }),\n };\n\n it(\"should populate query cache with threads data\", async () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboStubProvider\n thread={mockThread}\n threads={mockThreadsData}\n projectId=\"test-project\"\n components={[]}\n tools={[]}\n >\n {children}\n </TamboStubProvider>\n );\n\n const { result } = renderHook(() => useTamboThreadList(), { wrapper });\n // Wait for the effect to run\n await act(async () => {\n await new Promise((resolve) => setTimeout(resolve, 0));\n });\n\n // The hook should return the pre-populated threads data\n expect(result.current.data).toEqual(mockThreadsData);\n expect(result.current.isLoading).toBe(false);\n });\n\n it(\"should populate query cache with threads data using contextKey\", async () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboStubProvider\n thread={mockThread}\n threads={mockThreadsData}\n projectId=\"test-project\"\n contextKey=\"test-context\"\n components={[]}\n tools={[]}\n >\n {children}\n </TamboStubProvider>\n );\n\n const { result } = renderHook(\n () => useTamboThreadList({ contextKey: \"test-context\" }),\n { wrapper },\n );\n // Wait for the effect to run\n await act(async () => {\n await new Promise((resolve) => setTimeout(resolve, 0));\n });\n\n // The hook should return the pre-populated threads data for the specific context\n expect(result.current.data).toEqual(mockThreadsData);\n expect(result.current.isLoading).toBe(false);\n });\n\n it(\"should default projectId to thread.projectId when not provided\", async () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboStubProvider\n thread={mockThread}\n threads={mockThreadsData}\n // No explicit projectId provided - should use thread.projectId\n components={[]}\n tools={[]}\n >\n {children}\n </TamboStubProvider>\n );\n\n const { result } = renderHook(() => useTamboThreadList(), { wrapper });\n // Wait for the effect to run\n await act(async () => {\n await new Promise((resolve) => setTimeout(resolve, 0));\n });\n\n // The hook should return the pre-populated threads data using thread.projectId\n expect(result.current.data).toEqual(mockThreadsData);\n expect(result.current.isLoading).toBe(false);\n });\n});\n"]}
|
|
@@ -22,6 +22,7 @@ Object.defineProperty(global, "crypto", {
|
|
|
22
22
|
// Mock the required providers
|
|
23
23
|
jest.mock("../tambo-client-provider", () => ({
|
|
24
24
|
useTamboClient: jest.fn(),
|
|
25
|
+
useTamboQueryClient: jest.fn(),
|
|
25
26
|
}));
|
|
26
27
|
jest.mock("@tambo-ai/typescript-sdk", () => ({
|
|
27
28
|
advanceStream: jest.fn(),
|
|
@@ -74,15 +75,20 @@ describe("TamboThreadProvider", () => {
|
|
|
74
75
|
},
|
|
75
76
|
retrieve: jest.fn(),
|
|
76
77
|
advance: jest.fn(),
|
|
77
|
-
|
|
78
|
+
advanceByID: jest.fn(),
|
|
79
|
+
};
|
|
80
|
+
const mockProjectsApi = {
|
|
81
|
+
getCurrent: jest.fn(),
|
|
78
82
|
};
|
|
79
83
|
const mockBeta = {
|
|
80
84
|
threads: mockThreadsApi,
|
|
85
|
+
projects: mockProjectsApi,
|
|
81
86
|
};
|
|
82
87
|
const mockTamboAI = {
|
|
83
88
|
apiKey: "",
|
|
84
89
|
beta: mockBeta,
|
|
85
90
|
};
|
|
91
|
+
let mockQueryClient;
|
|
86
92
|
const mockRegistry = [
|
|
87
93
|
{
|
|
88
94
|
name: "TestOnly",
|
|
@@ -113,6 +119,14 @@ describe("TamboThreadProvider", () => {
|
|
|
113
119
|
react_2.default.createElement(tambo_thread_provider_1.TamboThreadProvider, { streaming: false }, children))));
|
|
114
120
|
beforeEach(() => {
|
|
115
121
|
jest.clearAllMocks();
|
|
122
|
+
// Setup mock query client
|
|
123
|
+
mockQueryClient = {
|
|
124
|
+
invalidateQueries: jest.fn().mockResolvedValue(undefined),
|
|
125
|
+
setQueryData: jest.fn(),
|
|
126
|
+
};
|
|
127
|
+
jest
|
|
128
|
+
.mocked(tambo_client_provider_1.useTamboQueryClient)
|
|
129
|
+
.mockReturnValue(mockQueryClient);
|
|
116
130
|
jest.mocked(mockThreadsApi.retrieve).mockResolvedValue(mockThread);
|
|
117
131
|
jest
|
|
118
132
|
.mocked(mockThreadsApi.messages.create)
|
|
@@ -121,8 +135,15 @@ describe("TamboThreadProvider", () => {
|
|
|
121
135
|
.mocked(mockThreadsApi.advance)
|
|
122
136
|
.mockResolvedValue(createMockAdvanceResponse());
|
|
123
137
|
jest
|
|
124
|
-
.mocked(mockThreadsApi.
|
|
138
|
+
.mocked(mockThreadsApi.advanceByID)
|
|
125
139
|
.mockResolvedValue(createMockAdvanceResponse());
|
|
140
|
+
jest.mocked(mockProjectsApi.getCurrent).mockResolvedValue({
|
|
141
|
+
id: "test-project-id",
|
|
142
|
+
name: "Test Project",
|
|
143
|
+
isTokenRequired: false,
|
|
144
|
+
providerType: "llm",
|
|
145
|
+
userId: "test-user-id",
|
|
146
|
+
});
|
|
126
147
|
jest.mocked(tambo_client_provider_1.useTamboClient).mockReturnValue(mockTamboAI);
|
|
127
148
|
});
|
|
128
149
|
it("should initialize with placeholder thread", () => {
|
|
@@ -200,7 +221,7 @@ describe("TamboThreadProvider", () => {
|
|
|
200
221
|
mcpAccessToken: "test-mcp-access-token",
|
|
201
222
|
};
|
|
202
223
|
jest
|
|
203
|
-
.mocked(mockThreadsApi.
|
|
224
|
+
.mocked(mockThreadsApi.advanceByID)
|
|
204
225
|
.mockResolvedValue(mockAdvanceResponse);
|
|
205
226
|
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), { wrapper });
|
|
206
227
|
await (0, react_1.act)(async () => {
|
|
@@ -214,7 +235,7 @@ describe("TamboThreadProvider", () => {
|
|
|
214
235
|
},
|
|
215
236
|
});
|
|
216
237
|
});
|
|
217
|
-
expect(mockThreadsApi.
|
|
238
|
+
expect(mockThreadsApi.advanceByID).toHaveBeenCalledWith("test-thread-1", {
|
|
218
239
|
messageToAppend: {
|
|
219
240
|
content: [{ type: "text", text: "Hello" }],
|
|
220
241
|
role: "user",
|
|
@@ -280,7 +301,7 @@ describe("TamboThreadProvider", () => {
|
|
|
280
301
|
mcpAccessToken: "test-mcp-access-token",
|
|
281
302
|
};
|
|
282
303
|
jest
|
|
283
|
-
.mocked(mockThreadsApi.
|
|
304
|
+
.mocked(mockThreadsApi.advanceByID)
|
|
284
305
|
.mockResolvedValueOnce(mockToolCallResponse)
|
|
285
306
|
.mockResolvedValueOnce({
|
|
286
307
|
responseMessageDto: {
|
|
@@ -333,7 +354,7 @@ describe("TamboThreadProvider", () => {
|
|
|
333
354
|
mcpAccessToken: "test-mcp-access-token",
|
|
334
355
|
};
|
|
335
356
|
jest
|
|
336
|
-
.mocked(mockThreadsApi.
|
|
357
|
+
.mocked(mockThreadsApi.advanceByID)
|
|
337
358
|
.mockResolvedValueOnce(mockUnregisteredToolCallResponse)
|
|
338
359
|
.mockResolvedValueOnce({
|
|
339
360
|
responseMessageDto: {
|
|
@@ -379,7 +400,7 @@ describe("TamboThreadProvider", () => {
|
|
|
379
400
|
mcpAccessToken: "test-mcp-access-token",
|
|
380
401
|
};
|
|
381
402
|
jest
|
|
382
|
-
.mocked(mockThreadsApi.
|
|
403
|
+
.mocked(mockThreadsApi.advanceByID)
|
|
383
404
|
.mockResolvedValueOnce(mockUnregisteredToolCallResponse)
|
|
384
405
|
.mockResolvedValueOnce({
|
|
385
406
|
responseMessageDto: {
|
|
@@ -463,7 +484,7 @@ describe("TamboThreadProvider", () => {
|
|
|
463
484
|
}, "test-thread-1");
|
|
464
485
|
// Should not call advance or advanceById
|
|
465
486
|
expect(mockThreadsApi.advance).not.toHaveBeenCalled();
|
|
466
|
-
expect(mockThreadsApi.
|
|
487
|
+
expect(mockThreadsApi.advanceByID).not.toHaveBeenCalled();
|
|
467
488
|
});
|
|
468
489
|
it("should call advanceById when streamResponse=false for existing thread", async () => {
|
|
469
490
|
// Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting
|
|
@@ -487,7 +508,7 @@ describe("TamboThreadProvider", () => {
|
|
|
487
508
|
},
|
|
488
509
|
});
|
|
489
510
|
});
|
|
490
|
-
expect(mockThreadsApi.
|
|
511
|
+
expect(mockThreadsApi.advanceByID).toHaveBeenCalledWith("test-thread-1", {
|
|
491
512
|
messageToAppend: {
|
|
492
513
|
content: [{ type: "text", text: "Hello non-streaming" }],
|
|
493
514
|
role: "user",
|
|
@@ -529,7 +550,7 @@ describe("TamboThreadProvider", () => {
|
|
|
529
550
|
},
|
|
530
551
|
});
|
|
531
552
|
});
|
|
532
|
-
expect(mockThreadsApi.
|
|
553
|
+
expect(mockThreadsApi.advanceByID).toHaveBeenCalledWith("test-thread-1", {
|
|
533
554
|
messageToAppend: {
|
|
534
555
|
content: [{ type: "text", text: "Hello default" }],
|
|
535
556
|
role: "user",
|
|
@@ -608,7 +629,7 @@ describe("TamboThreadProvider", () => {
|
|
|
608
629
|
}, "test-thread-1");
|
|
609
630
|
// Should not call advance or advanceById
|
|
610
631
|
expect(mockThreadsApi.advance).not.toHaveBeenCalled();
|
|
611
|
-
expect(mockThreadsApi.
|
|
632
|
+
expect(mockThreadsApi.advanceByID).not.toHaveBeenCalled();
|
|
612
633
|
});
|
|
613
634
|
it("should call advance when streamResponse=false for placeholder thread", async () => {
|
|
614
635
|
// Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting
|
|
@@ -651,7 +672,7 @@ describe("TamboThreadProvider", () => {
|
|
|
651
672
|
toolCallCounts: {},
|
|
652
673
|
});
|
|
653
674
|
// Should not call advanceById or advanceStream
|
|
654
|
-
expect(mockThreadsApi.
|
|
675
|
+
expect(mockThreadsApi.advanceByID).not.toHaveBeenCalled();
|
|
655
676
|
expect(typescript_sdk_1.advanceStream).not.toHaveBeenCalled();
|
|
656
677
|
});
|
|
657
678
|
it("should call advanceStream when streamResponse=true for placeholder thread", async () => {
|
|
@@ -715,14 +736,14 @@ describe("TamboThreadProvider", () => {
|
|
|
715
736
|
}, undefined);
|
|
716
737
|
// Should not call advance or advanceById
|
|
717
738
|
expect(mockThreadsApi.advance).not.toHaveBeenCalled();
|
|
718
|
-
expect(mockThreadsApi.
|
|
739
|
+
expect(mockThreadsApi.advanceByID).not.toHaveBeenCalled();
|
|
719
740
|
});
|
|
720
741
|
});
|
|
721
742
|
describe("error handling", () => {
|
|
722
743
|
it("should set generation stage to ERROR when non-streaming sendThreadMessage fails", async () => {
|
|
723
744
|
const testError = new Error("API call failed");
|
|
724
745
|
// Mock advanceById to throw an error
|
|
725
|
-
jest.mocked(mockThreadsApi.
|
|
746
|
+
jest.mocked(mockThreadsApi.advanceByID).mockRejectedValue(testError);
|
|
726
747
|
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), { wrapper });
|
|
727
748
|
// Expect the error to be thrown
|
|
728
749
|
await (0, react_1.act)(async () => {
|
|
@@ -769,5 +790,68 @@ describe("TamboThreadProvider", () => {
|
|
|
769
790
|
expect(result.current.generationStage).toBe(generate_component_response_1.GenerationStage.ERROR);
|
|
770
791
|
});
|
|
771
792
|
});
|
|
793
|
+
describe("refetch threads list behavior", () => {
|
|
794
|
+
it("should refetch threads list when creating a new thread via sendThreadMessage", async () => {
|
|
795
|
+
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), { wrapper });
|
|
796
|
+
// Mock the advance response to return a new thread ID
|
|
797
|
+
const mockAdvanceResponse = {
|
|
798
|
+
responseMessageDto: {
|
|
799
|
+
id: "response-1",
|
|
800
|
+
content: [{ type: "text", text: "Response" }],
|
|
801
|
+
role: "assistant",
|
|
802
|
+
threadId: "new-thread-123",
|
|
803
|
+
component: undefined,
|
|
804
|
+
componentState: {},
|
|
805
|
+
createdAt: new Date().toISOString(),
|
|
806
|
+
},
|
|
807
|
+
generationStage: generate_component_response_1.GenerationStage.COMPLETE,
|
|
808
|
+
mcpAccessToken: "test-mcp-access-token",
|
|
809
|
+
};
|
|
810
|
+
jest
|
|
811
|
+
.mocked(mockThreadsApi.advance)
|
|
812
|
+
.mockResolvedValue(mockAdvanceResponse);
|
|
813
|
+
// Start with placeholder thread
|
|
814
|
+
expect(result.current.thread.id).toBe("placeholder");
|
|
815
|
+
// Send a message which will create a new thread with contextKey
|
|
816
|
+
await (0, react_1.act)(async () => {
|
|
817
|
+
await result.current.sendThreadMessage("Hello", {
|
|
818
|
+
threadId: "placeholder",
|
|
819
|
+
streamResponse: false,
|
|
820
|
+
contextKey: "test-context-key",
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
// Verify that setQueryData was called first (optimistic update)
|
|
824
|
+
expect(mockQueryClient.setQueryData).toHaveBeenCalledWith(["threads", "test-project-id", "test-context-key"], expect.any(Function));
|
|
825
|
+
// Verify that refetchQueries was called when the new thread was created
|
|
826
|
+
expect(mockQueryClient.invalidateQueries).toHaveBeenCalledWith({
|
|
827
|
+
queryKey: ["threads"],
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
it("should not refetch threads list when switching between existing threads", async () => {
|
|
831
|
+
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), { wrapper });
|
|
832
|
+
// Start with placeholder thread
|
|
833
|
+
expect(result.current.thread.id).toBe("placeholder");
|
|
834
|
+
// Clear any previous mock calls
|
|
835
|
+
jest.clearAllMocks();
|
|
836
|
+
// Mock the retrieve call to return the expected thread
|
|
837
|
+
const existingThread = createMockThread({ id: "existing-thread-123" });
|
|
838
|
+
jest
|
|
839
|
+
.mocked(mockThreadsApi.retrieve)
|
|
840
|
+
.mockResolvedValueOnce(existingThread);
|
|
841
|
+
// Switch to an existing thread (this should not trigger refetch)
|
|
842
|
+
await (0, react_1.act)(async () => {
|
|
843
|
+
await result.current.switchCurrentThread("existing-thread-123");
|
|
844
|
+
});
|
|
845
|
+
// Verify that the thread retrieval was called
|
|
846
|
+
expect(mockThreadsApi.retrieve).toHaveBeenCalledWith("existing-thread-123", {
|
|
847
|
+
includeInternal: true,
|
|
848
|
+
});
|
|
849
|
+
// Verify that neither setQueryData nor refetchQueries were called
|
|
850
|
+
expect(mockQueryClient.setQueryData).not.toHaveBeenCalled();
|
|
851
|
+
expect(mockQueryClient.invalidateQueries).not.toHaveBeenCalled();
|
|
852
|
+
// Verify the thread was switched correctly
|
|
853
|
+
expect(result.current.thread.id).toBe("existing-thread-123");
|
|
854
|
+
});
|
|
855
|
+
});
|
|
772
856
|
});
|
|
773
857
|
//# sourceMappingURL=tambo-thread-provider.test.js.map
|