import { h as n, gs as o, v as i } from "./56c67d3b.js";
import "react";
import "react-dom";
const s = {
  v1: i(0),
  v2: i("abc")
};
test("with type", () => {
  const c = n(s, "v2"), t = new c({});
  t.getView();
  const e = t.getTypeSafeView();
  expect(e).toBe("abc");
});
test("withTypeAndChildrenAbstract", () => {
  const c = o(s, "v2", {}), t = class extends c {
    getView() {
      return this.children.compType.getView();
    }
  }, e = new t({});
  e.getView();
  const p = e.getTypeSafeView();
  expect(p).toBe("abc");
});
test("withTypeAndChildrenAbstract with custom", () => {
  const c = o(s, "v2", {}, "myType", "myComp"), t = class extends c {
    getView() {
      return this.children.myComp.getView();
    }
  }, e = new t({});
  e.getView();
  const p = e.getTypeSafeView();
  expect(p).toBe("abc");
});
test("withTypeAndChildrenAbstract preserve previous value", () => {
  const c = o(s, "v2", {}, "myType", "myComp"), t = class extends c {
    getView() {
      return this.children.myComp.getView();
    }
  };
  let e = new t({
    dispatch: (p) => {
      e && (e = e.reduce(p));
    }
  });
  expect(e.getTypeSafeView()).toBe("abc"), e.dispatchChangeAndPreserveAction({
    myType: "v1",
    myComp: 1
  }), expect(e.getTypeSafeView()).toBe(1), e.dispatchChangeAndPreserveAction({
    myType: "v2"
  }), expect(e.getTypeSafeView()).toBe("abc"), e.dispatchChangeAndPreserveAction({
    myType: "v1"
  }), expect(e.getTypeSafeView()).toBe(1), e.dispatchChangeAndPreserveAction({
    myType: "v2",
    myComp: "cde"
  }), expect(e.getTypeSafeView()).toBe("cde"), expect(e.toJsonValue()).toMatchObject({
    myType: "v2",
    myComp: "cde"
  });
});
