var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
  return new Promise((resolve, reject) => {
    var fulfilled = (value) => {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = (value) => {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
    step((generator = generator.apply(__this, __arguments)).next());
  });
};

// src/relay/Feedback/Feedback.test.tsx
import { expect, it, vi, describe, beforeEach } from "vitest";
import { composeStories } from "@storybook/react";
import * as stories from "./Feedback.stories.mjs";
import { render } from "vitest-browser-react";
import * as React from "react";
import { page } from "@vitest/browser/context";
var { Primary } = composeStories(stories);
var bubbleMock = vi.fn();
var generateEventMock = vi.fn();
vi.mock("@nova/react", () => __async(void 0, null, function* () {
  const actual = yield vi.importActual("@nova/react");
  return __spreadProps(__spreadValues({}, actual), {
    useNovaEventing: () => ({
      bubble: bubbleMock,
      generateEvent: generateEventMock
    })
  });
}));
beforeEach(() => {
  vi.clearAllMocks();
});
describe("Feedback", () => {
  it("rerenders without unmounting", () => __async(void 0, null, function* () {
    const { rerender } = render(/* @__PURE__ */ React.createElement(Primary, null));
    let likeButton = page.getByRole("button", { name: "Like" });
    yield expect.element(likeButton).toBeInTheDocument();
    let telemetryEvents = generateEventMock.mock.calls.filter(
      ([{ event }]) => event.type === "feedbackTelemetry"
    );
    expect(telemetryEvents).toHaveLength(1);
    rerender(/* @__PURE__ */ React.createElement(Primary, null));
    likeButton = page.getByRole("button", { name: "Like" });
    yield expect.element(likeButton).toBeInTheDocument();
    telemetryEvents = generateEventMock.mock.calls.filter(
      ([{ event }]) => event.type === "feedbackTelemetry"
    );
    expect(telemetryEvents).toHaveLength(1);
  }));
});
