on-internet
← Community

Testing zustand state changes caused by a component in Jest

Stack Overflow ·

I am pretty new to using jest and Im trying to test a component that makes a state change which acts upon my global state (using Zustand). Basically im clicking a button and its adding an item to my state.traits. Here is my component code: import { Flex, useToast } from '@chakra-ui/react' import { FC } from 'react' import { useProfileStore } from 'stores/profileStore' interface DataTrait { name: string, id: string } type Props = { trait: DataTrait } export const ChipItem: FC<Props> = ({ trait }) => { const { traits, setTraits } = useProfileStore() const toast = useToast() const traitNames = tr

Comments

Sign in or sign up to comment and upvote.

No comments yet.