import { flushPromises, mount } from "@vue/test-utils";
import { describe, expect, it } from "vitest";

import App from "./App.vue";

describe("App", () => {
  it("renders the canonical demo PlayerView", async () => {
    const wrapper = mount(App);
    await flushPromises();

    expect(wrapper.text()).toContain("听娜娜讲故事");
    expect(wrapper.text()).toContain("娜娜");
    expect(wrapper.text()).toContain("你真的会在天亮前回来吗？");
    expect(wrapper.get('textarea[aria-label="自由输入"]')).toBeDefined();
  });

  it("copies an editable suggestion into the composer", async () => {
    const wrapper = mount(App);
    await flushPromises();
    await wrapper.get(".suggestions button").trigger("click");

    const composer = wrapper.get<HTMLTextAreaElement>("textarea");
    expect(composer.element.value.length).toBeGreaterThan(0);
  });
});
