import { gD as u, cP as n, _ as i, gE as p, e0 as l } from "./56c67d3b.js";
import "react";
import "react-dom";
it("test action handler", (c) => {
  const [r] = u();
  let e = 0;
  const a = n(0, !0), t = {
    action: a,
    reduceFn: () => {
      e += 1;
    }
  }, s = {
    ...t,
    action: {
      ...a,
      priority: "defer"
    }
  }, d = {
    ...t,
    action: void 0
  };
  i.range(3).forEach(() => {
    r(t);
  }), expect(e).toBe(3), i.range(3).forEach(() => {
    r(s);
  }), expect(e).toBe(3), r(t), expect(e).toBe(7);
  let o = 0;
  i.range(3).forEach(() => {
    o = r(s);
  }), expect(o).toBe(3), expect(e).toBe(7), setTimeout(() => {
    o = r(d), expect(e).toBe(11), expect(o).toBe(0), c();
  }), r(s);
});
test("nestDispatchHandler", () => {
  const c = p(), r = [], e = (a) => {
    c(a, (t) => {
      t.type === l.CHANGE_VALUE && (r.push("start" + t.value), t.value === 1 && (e(n(2, !0)), e(n(4, !0))), t.value === 2 && e(n(3, !0)), t.value === 4 && e(n(5, !0)), t.value === 6 && e(n(7, !0)), r.push("end" + t.value));
    });
  };
  e(n(1, !0)), e(n(6, !0)), expect(r).toStrictEqual(["start1", "end1", "start2", "end2", "start3", "end3", "start4", "end4", "start5", "end5", "start6", "end6", "start7", "end7"]);
});
