const __vite_ssr_import_0__ = await __vite_ssr_import__("/web/node_modules/@tanstack/react-query/build/modern/index.js", {"importedNames":["QueryClient","QueryClientProvider"]});
const __vite_ssr_import_1__ = await __vite_ssr_import__("/web/node_modules/@testing-library/react/dist/index.js", {"importedNames":["fireEvent","render","screen","waitFor"]});
const __vite_ssr_import_2__ = await __vite_ssr_import__("/web/node_modules/msw/lib/core/index.mjs", {"importedNames":["http","HttpResponse"]});
const __vite_ssr_import_3__ = await __vite_ssr_import__("/web/node_modules/msw/lib/node/index.mjs", {"importedNames":["setupServer"]});
const __vite_ssr_import_4__ = await __vite_ssr_import__("/@fs/C:/Users/Admin/AppData/Local/npm-cache/_npx/69c381f8ad94b576/node_modules/vitest/dist/index.js", {"importedNames":["afterAll","afterEach","beforeAll","describe","expect","it"]});
const __vite_ssr_import_5__ = await __vite_ssr_import__("@/shared/i18n");
const __vite_ssr_import_6__ = await __vite_ssr_import__("/web/src/features/review-suggestion/SuggestionActions.tsx", {"importedNames":["SuggestionActions"]});
const __vite_ssr_import_7__ = await __vite_ssr_import__("/web/node_modules/react/jsx-dev-runtime.js", {"importedNames":["jsxDEV"]});







var _jsxFileName = "D:/GitHub/ViceCut/web/src/features/review-suggestion/SuggestionActions.test.tsx";

const calls = [];
const server = (0,__vite_ssr_import_3__.setupServer)(__vite_ssr_import_2__.http.post(/\/api\/v1\/channels\/c1:(follow|ignore|block)$/, ({ request }) => {
	calls.push(new URL(request.url).pathname);
	return __vite_ssr_import_2__.HttpResponse.json({
		id: "c1",
		status: "following",
		priority: 3
	});
}), __vite_ssr_import_2__.http.post(/\/api\/v1\/channels\/c2:ignore$/, () => __vite_ssr_import_2__.HttpResponse.json({
	detail: "cannot ignore a blocked channel",
	code: "invalid_transition"
}, { status: 409 })));
(0,__vite_ssr_import_4__.beforeAll)(() => server.listen({ onUnhandledRequest: "error" }));
(0,__vite_ssr_import_4__.afterEach)(() => calls.splice(0));
(0,__vite_ssr_import_4__.afterAll)(() => server.close());
function channel(id) {
	return {
		id,
		channel_id: "UC1",
		handle: "@sock",
		name: "Sóc",
		status: "suggested",
		priority: 3,
		auto_discovered: true,
		added_at: "2026-11-22T10:00:00Z",
		note: "Live with 1,250 viewers",
		clips_7d: 0,
		avg_score: null
	};
}
function renderActions(id) {
	const client = new __vite_ssr_import_0__.QueryClient({ defaultOptions: { mutations: { retry: false } } });
	(0,__vite_ssr_import_1__.render)(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_0__.QueryClientProvider), {
		client,
		children: /* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_6__.SuggestionActions), { channel: channel(id) }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 46,
			columnNumber: 7
		}, this)
	}, void 0, false, {
		fileName: _jsxFileName,
		lineNumber: 45,
		columnNumber: 5
	}, this));
}
(0,__vite_ssr_import_4__.describe)("SuggestionActions", () => {
	__vite_ssr_import_4__.it.each([
		["Follow", ":follow"],
		["Not now", ":ignore"],
		["Block", ":block"]
	])("%s calls the matching endpoint", async (label, suffix) => {
		renderActions("c1");
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: label }));
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_4__.expect)(calls).toEqual([`/api/v1/channels/c1${suffix}`]));
	});
	(0,__vite_ssr_import_4__.it)("shows the server's reason when the change is refused", async () => {
		renderActions("c2");
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: "Not now" }));
		(0,__vite_ssr_import_4__.expect)(await __vite_ssr_import_1__.screen.findByText("cannot ignore a blocked channel")).toBeInTheDocument();
	});
});

//# vitestCache=W3siZmlsZSI6IjEiLCJpZCI6IjEiLCJpbXBvcnRzIjoiMiIsIm1hcHBpbmdzIjpmYWxzZSwiZGVwcyI6IjMiLCJkeW5hbWljRGVwcyI6IjQiLCJzdGF0aWNNb2NrcyI6bnVsbCwiaGF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CAAC,CAAC,CAAC,kBAAkB;CACvF,CAAC;AACH,CAAC","names":[],"ignoreList":[],"sources":["SuggestionActions.test.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { fireEvent, render, screen, waitFor } from \"@testing-library/react\";\nimport { http, HttpResponse } from \"msw\";\nimport { setupServer } from \"msw/node\";\nimport { afterAll, afterEach, beforeAll, describe, expect, it } from \"vitest\";\n\nimport type { Channel } from \"@/entities/channel\";\nimport \"@/shared/i18n\";\n\nimport { SuggestionActions } from \"./SuggestionActions\";\n\nconst calls: string[] = [];\nconst server = setupServer(\n  http.post(/\\/api\\/v1\\/channels\\/c1:(follow|ignore|block)$/, ({ request }) => {\n    calls.push(new URL(request.url).pathname);\n    return HttpResponse.json({ id: \"c1\", status: \"following\", priority: 3 });\n  }),\n  http.post(/\\/api\\/v1\\/channels\\/c2:ignore$/, () =>\n    HttpResponse.json({ detail: \"cannot ignore a blocked channel\", code: \"invalid_transition\" }, { status: 409 }),\n  ),\n);\nbeforeAll(() => server.listen({ onUnhandledRequest: \"error\" }));\nafterEach(() => calls.splice(0));\nafterAll(() => server.close());\n\nfunction channel(id: string): Channel {\n  return {\n    id,\n    channel_id: \"UC1\",\n    handle: \"@sock\",\n    name: \"Sóc\",\n    status: \"suggested\",\n    priority: 3,\n    auto_discovered: true,\n    added_at: \"2026-11-22T10:00:00Z\",\n    note: \"Live with 1,250 viewers\",\n    clips_7d: 0,\n    avg_score: null,\n  };\n}\n\nfunction renderActions(id: string) {\n  const client = new QueryClient({ defaultOptions: { mutations: { retry: false } } });\n  render(\n    <QueryClientProvider client={client}>\n      <SuggestionActions channel={channel(id)} />\n    </QueryClientProvider>,\n  );\n}\n\ndescribe(\"SuggestionActions\", () => {\n  it.each([\n    [\"Follow\", \":follow\"],\n    [\"Not now\", \":ignore\"],\n    [\"Block\", \":block\"],\n  ])(\"%s calls the matching endpoint\", async (label, suffix) => {\n    renderActions(\"c1\");\n    fireEvent.click(screen.getByRole(\"button\", { name: label }));\n    await waitFor(() => expect(calls).toEqual([`/api/v1/channels/c1${suffix}`]));\n  });\n\n  it(\"shows the server's reason when the change is refused\", async () => {\n    renderActions(\"c2\");\n    fireEvent.click(screen.getByRole(\"button\", { name: \"Not now\" }));\n    expect(await screen.findByText(\"cannot ignore a blocked channel\")).toBeInTheDocument();\n  });\n});\n"],"file":"/web/src/features/review-suggestion/SuggestionActions.test.tsx"}