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/apollo/Feedback/FeedbackContainer.test.tsx
import { expect, it, vi, describe, beforeEach } from "vitest";
import { composeStories } from "@storybook/react";
import * as stories from "./FeedbackContainer.stories.mjs";
import * as React from "react";
import { prepareStoryContextForTest } from "@nova/react-test-utils/apollo";
import { render } from "vitest-browser-react";
import { page } from "@vitest/browser/context";
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();
});
var { Primary, Liked, LikeFailure } = composeStories(stories);
describe("FeedbackContainer", () => {
  it("should correctly propagate parameters even when multiple stories with same resolvers are rendered", () => __async(void 0, null, function* () {
    render(/* @__PURE__ */ React.createElement(Primary, null));
    render(/* @__PURE__ */ React.createElement(Liked, null));
    render(/* @__PURE__ */ React.createElement(Primary, null));
    const text = "Feedback: Feedback title";
    yield vi.waitFor(
      () => {
        const texts = page.getByText(text);
        expect(texts.elements()).toHaveLength(3);
      },
      { timeout: 3e3 }
    );
  }));
  it("should show an error if the like button fails", () => __async(void 0, null, function* () {
    var _a;
    const { container } = render(/* @__PURE__ */ React.createElement(LikeFailure, null));
    yield (_a = LikeFailure.play) == null ? void 0 : _a.call(
      LikeFailure,
      prepareStoryContextForTest(LikeFailure, container)
    );
    const error = page.getByText("Something went wrong");
    yield expect.element(error).toBeInTheDocument();
  }));
});
