Skip to content

Commit

Permalink
test: remove flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
atheck committed Mar 24, 2024
1 parent b018af6 commit a91b6db
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions src/useElmish.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, type RenderResult } from "@testing-library/react";
import { useEffect, type JSX } from "react";
import type { JSX } from "react";
import { cmd, useElmish, type Cmd, type InitResult, type SubscriptionResult, type UpdateReturnType } from ".";
import type { UpdateFunctionOptions } from "./Types";

Expand Down Expand Up @@ -182,36 +182,3 @@ function TestComponent(props: Props): JSX.Element {
function renderComponent(props: Props): RenderResult {
return render(<TestComponent {...props} />);
}

function TestComponentWithEffect(props: Props): JSX.Element {
const { init, update, subscription } = props;
const [model, dispatch] = useElmish({
props,
init,
update,
subscription,
name: "Test",
});

if (model.value1 === "") {
setTimeout(() => dispatch({ name: "First" }), 5);
}

if (model.value1 === "First" && model.value2 === "") {
setTimeout(() => dispatch({ name: "Second" }), 5);
}

componentModel = model;

useEffect(() => {
setTimeout(() => {
dispatch({ name: "Third" });
}, 20);
}, [dispatch]);

return <div />;
}

function renderComponentWithEffect(props: Props): RenderResult {
return render(<TestComponentWithEffect {...props} />);
}

0 comments on commit a91b6db

Please sign in to comment.