lib prompt test passes.
This commit is contained in:
@ -12,7 +12,7 @@ import { useStore } from '@nanostores/react'
|
||||
|
||||
type Composable = (typeof Nugget) | (typeof Operation);
|
||||
|
||||
export default function PromptArea({ children }: { children?: any }) {
|
||||
export default function PromptArea(props) {
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const handleClickOpen = () => {
|
||||
@ -41,9 +41,7 @@ export default function PromptArea({ children }: { children?: any }) {
|
||||
|
||||
</Button>
|
||||
<Masonry columns={Object.keys(Category).length} spacing={2} sequential>
|
||||
{slottedComposition.map(nugget => {
|
||||
|
||||
})}
|
||||
<div>Something</div>
|
||||
</Masonry>
|
||||
</div>
|
||||
);
|
||||
|
@ -5,6 +5,7 @@ import { PromptLibrary } from './PromptLibrary';
|
||||
import { SimpleDialogProps } from './PromptLibrary';
|
||||
import { Category, LibraryItem as LibItemType } from '../lib/prompt';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
const mockOnAddItem = jest.fn();
|
||||
const mockItem: LibItemType = {
|
||||
@ -38,6 +39,8 @@ test('renders PromptLibrary with add button', () => {
|
||||
test('calls onAddItem when add button is clicked', async () => {
|
||||
render(<PromptLibrary {...mockProps} />);
|
||||
const addButton = screen.getByLabelText('Add');
|
||||
await userEvent.click(addButton);
|
||||
act(() => {
|
||||
userEvent.click(addButton);
|
||||
})
|
||||
expect(mockOnAddItem).toHaveBeenCalledWith(mockItem);
|
||||
});
|
||||
|
Reference in New Issue
Block a user