Skip to content

Commit

Permalink
chore(ai): update exported types, add exports snapshot test (#5768)
Browse files Browse the repository at this point in the history
* chore(ai): update exported types, add exports snapshot test

* Update packages/react-ai/src/index.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* chore: update package name in exports test

* update lint config to include exports.ts

* fix build issue

* fix build issue

---------

Co-authored-by: Caleb Pollman <cpollman@amazon.com>
  • Loading branch information
thaddmt and calebpollman authored Sep 9, 2024
1 parent 43e78b1 commit 2aa639d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
10 changes: 10 additions & 0 deletions packages/react-ai/src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`@aws-amplify/ui-react-ai exports should match snapshot 1`] = `
[
"AIContextProvider",
"AIConversation",
"createAIConversation",
"createAIHooks",
]
`;
11 changes: 11 additions & 0 deletions packages/react-ai/src/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as exported from '..';

describe('@aws-amplify/ui-react-ai', () => {
describe('exports', () => {
it('should match snapshot', () => {
const sortedExports = Object.keys(exported).sort();

expect(sortedExports).toMatchSnapshot();
});
});
});
16 changes: 15 additions & 1 deletion packages/react-ai/src/components/AIConversation/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import { createAIConversation } from './createAIConversation';
import { AIConversation } from './AIConversation';
export { createAIConversation, AIConversation };
import {
Avatars,
CustomAction,
ResponseComponent,
SuggestedPrompt,
} from './types';

export {
createAIConversation,
AIConversation,
Avatars,
CustomAction,
ResponseComponent,
SuggestedPrompt,
};
17 changes: 12 additions & 5 deletions packages/react-ai/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { createAIConversation, AIConversation } from './components';
import { createAIHooks, AIContextProvider } from './hooks';
export {
createAIConversation,
createAIHooks,
AIContextProvider,
AIConversation,
};
Avatars,
CustomAction,
ResponseComponent,
SuggestedPrompt,
} from './components';
export { createAIHooks, AIContextProvider } from './hooks';
export {
ConversationMessage,
ConversationMessageContent,
SendMessage,
SendMesageParameters,
} from './types';

0 comments on commit 2aa639d

Please sign in to comment.