import { resetFlowStore } from "../../../../test-utils/test-utils";
import useFlowStore from '../../../../../src/pages/VisProgPage/visualProgrammingUI/VisProgStores';
import addNode from "../../../../../src/pages/VisProgPage/visualProgrammingUI/utils/AddNode";


describe('PhaseNode', () => {
  beforeEach(() => resetFlowStore());

  it('each created phase gets its own children array (store-level)', () => {
    addNode("phase", {x:10,y:10})
    addNode("phase", {x:20,y:20})

    const nodes = useFlowStore.getState().nodes;
    const p1 = nodes.find((x) => x.id === 'phase-1')!;
    const p2 = nodes.find((x) => x.id === 'phase-2')!;

    // not the same reference
    expect(p1.data.children).not.toBe(p2.data.children);
    // but same initial value
    expect(p1.data.children).toEqual(p2.data.children);
  });
});