Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
961 B
2
Indexable
Never
    it("should not send survey result if closed on first step", async () => {
        const spy = jest.fn();
        server.use(mocks.reviews({ spy }), mocks.survey());

        const TestComponent = () => {
            const { show } = useProcessSurvey("ProcessCompleted", "testProcess");

            useEffect(() => {
                show({
                    clickstreamId: clickstreamIds.survey,
                    onSurveyClosed: () => {},
                });

                // eslint-disable-next-line react-hooks/exhaustive-deps
            }, []);

            return <div>test</div>;
        };

        render(<TestComponent />, { wrapper: SurveyContextProvider });

        const close = await screen.findByLabelText("Close");

        userEvent.click(close);

        await waitFor(
            () => {
                expect(spy).not.toBeCalled();
            },
            { timeout: 3000 },
        );
    });
Leave a Comment