this is my project code
const classes = useStyles();
const [projectName, setProjectName] = useState("--------");
const [projectDescription, setProjectDescription] = useState("-------");
let { id } = useParams();
const [isSubmitting, setSubmitting] = useState(false);
const [loading, setLoading] = useState(true);
when trying to update the useState in testcase like this:
const setState = jest.fn();
const useStateSpy = jest.spyOn(React, 'useState');
useStateSpy.mockImplementationOnce( (projectName) => [projectName= "Test Project" , setState]);
useStateSpy.mockImplementationOnce((projectDescription) => [projectDescription = "Test Data" , setState]);
these values of projectname and project description not changing,.
1 post - 1 participant