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__("/@fs/C:/Users/Admin/AppData/Local/npm-cache/_npx/69c381f8ad94b576/node_modules/vitest/dist/index.js", {"importedNames":["afterEach","describe","expect","it","vi"]});
const __vite_ssr_import_3__ = await __vite_ssr_import__("@/shared/api", {"importedNames":["api"]});
const __vite_ssr_import_4__ = await __vite_ssr_import__("@/shared/i18n");
const __vite_ssr_import_5__ = await __vite_ssr_import__("/web/src/features/manage-channel/ChannelActions.tsx", {"importedNames":["ChannelActions"]});
const __vite_ssr_import_6__ = await __vite_ssr_import__("/web/src/features/manage-channel/PrioritySelect.tsx", {"importedNames":["PrioritySelect"]});
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/manage-channel/ChannelActions.test.tsx";

const CHANNEL = {
	id: "c1",
	channel_id: "@meo",
	handle: "@meo",
	name: "Mèo Lười",
	status: "following",
	priority: 3,
	auto_discovered: false,
	added_at: "2026-11-21T12:00:00+00:00",
	note: "",
	clips_7d: 2,
	avg_score: 7.5
};
const STATE = {
	data: {
		id: "c1",
		status: "paused",
		priority: 3
	},
	response: new Response()
};
function wrap(children) {
	const client = new __vite_ssr_import_0__.QueryClient({ defaultOptions: { mutations: { retry: false } } });
	return /* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_0__.QueryClientProvider), {
		client,
		children
	}, void 0, false, {
		fileName: _jsxFileName,
		lineNumber: 21,
		columnNumber: 10
	}, this);
}
(0,__vite_ssr_import_2__.afterEach)(() => __vite_ssr_import_2__.vi.restoreAllMocks());
(0,__vite_ssr_import_2__.describe)("ChannelActions", () => {
	(0,__vite_ssr_import_2__.it)("pauses, resumes and blocks through the matching endpoint", async () => {
		const post = __vite_ssr_import_2__.vi.spyOn((0,__vite_ssr_import_3__.api), "POST").mockResolvedValue(STATE);
		const { rerender } = (0,__vite_ssr_import_1__.render)(wrap(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_5__.ChannelActions), { channel: CHANNEL }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 29,
			columnNumber: 38
		}, this)));
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: "Pause" }));
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_2__.expect)(post).toHaveBeenCalledWith("/api/v1/channels/{channel_id}:pause", { params: { path: { channel_id: "c1" } } }));
		rerender(wrap(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_5__.ChannelActions), { channel: {
			...CHANNEL,
			status: "paused"
		} }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 32,
			columnNumber: 19
		}, this)));
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: "Resume" }));
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_2__.expect)(post).toHaveBeenLastCalledWith("/api/v1/channels/{channel_id}:follow", __vite_ssr_import_2__.expect.anything()));
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: "Block" }));
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_2__.expect)(post).toHaveBeenLastCalledWith("/api/v1/channels/{channel_id}:block", __vite_ssr_import_2__.expect.anything()));
		rerender(wrap(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_5__.ChannelActions), { channel: {
			...CHANNEL,
			status: "blocked"
		} }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 37,
			columnNumber: 19
		}, this)));
		(0,__vite_ssr_import_2__.expect)(__vite_ssr_import_1__.screen.getByRole("button", { name: "Unblock" })).toBeInTheDocument();
	});
	(0,__vite_ssr_import_2__.it)("removes only after confirmation", async () => {
		const del = __vite_ssr_import_2__.vi.spyOn((0,__vite_ssr_import_3__.api), "DELETE").mockResolvedValue({
			data: undefined,
			response: new Response(null, { status: 204 })
		});
		(0,__vite_ssr_import_1__.render)(wrap(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_5__.ChannelActions), { channel: CHANNEL }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 43,
			columnNumber: 17
		}, this)));
		__vite_ssr_import_1__.fireEvent.click(__vite_ssr_import_1__.screen.getByRole("button", { name: "Remove" }));
		(0,__vite_ssr_import_2__.expect)(del).not.toHaveBeenCalled();
		(0,__vite_ssr_import_2__.expect)(__vite_ssr_import_1__.screen.getByText("Remove Mèo Lười?")).toBeInTheDocument();
		const buttons = __vite_ssr_import_1__.screen.getAllByRole("button", { name: "Remove" });
		const confirm = buttons[buttons.length - 1];
		if (confirm === undefined) throw new Error("no confirm button");
		__vite_ssr_import_1__.fireEvent.click(confirm);
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_2__.expect)(del).toHaveBeenCalledWith("/api/v1/channels/{channel_id}", { params: { path: { channel_id: "c1" } } }));
	});
	(0,__vite_ssr_import_2__.it)("changes the priority", async () => {
		const patch = __vite_ssr_import_2__.vi.spyOn((0,__vite_ssr_import_3__.api), "PATCH").mockResolvedValue(STATE);
		(0,__vite_ssr_import_1__.render)(wrap(/* @__PURE__ */ (0,__vite_ssr_import_7__.jsxDEV)((0,__vite_ssr_import_6__.PrioritySelect), { channel: CHANNEL }, void 0, false, {
			fileName: _jsxFileName,
			lineNumber: 56,
			columnNumber: 17
		}, this)));
		__vite_ssr_import_1__.fireEvent.change(__vite_ssr_import_1__.screen.getByLabelText("Priority of Mèo Lười"), { target: { value: "5" } });
		await (0,__vite_ssr_import_1__.waitFor)(() => (0,__vite_ssr_import_2__.expect)(patch).toHaveBeenCalledWith("/api/v1/channels/{channel_id}", {
			params: { path: { channel_id: "c1" } },
			body: { priority: 5 }
		}));
	});
});

//# vitestCache=W3siZmlsZSI6IjEiLCJpZCI6IjEiLCJpbXBvcnRzIjoiMiIsIm1hcHBpbmdzIjpmYWxzZSwiZGVwcyI6IjMiLCJkeW5hbWljRGVwcyI6IjQiLCJzdGF0aWNNb2NrcyI6bnVsbCwiaGFzQ292ZXJhZ2VEYXRhIjpmYWxzZX0sIkQ6L0dpdEh1Yi9WaWNlQ3V0L3dlYi9zcmMvZmVhdHVyZXMvbWFuYWdlLWNoYW5uZWwvQ2hhbm5lbEFjdGlvbnMudGVzdC50c3giLHsidXJscyI6IjUiLCJpZHMiOiI2In0sWyI3IiwiOCIsIjkiLCIxMCIsIjExIiwiMTIiLCIxMyIsIjE0Il0sW10sWyI3IiwiOCIsIjkiLCIxMCIsIjExIiwiMTIiLCIxMyIsIjE0Il0se30sIi93ZWIvbm9kZV9tb2R1bGVzL0B0YW5zdGFjay9yZWFjdC1xdWVyeS9idWlsZC9tb2Rlcm4vaW5kZXguanMiLCIvd2ViL25vZGVfbW9kdWxlcy9AdGVzdGluZy1saWJyYXJ5L3JlYWN0L2Rpc3QvaW5kZXguanMiLCIvQGZzL0M6L1VzZXJzL0FkbWluL0FwcERhdGEvTG9jYWwvbnBtLWNhY2hlL19ucHgvNjljMzgxZjhhZDk0YjU3Ni9ub2RlX21vZHVsZXMvdml0ZXN0L2Rpc3QvaW5kZXguanMiLCJAL3NoYXJlZC9hcGkiLCJAL3NoYXJlZC9pMThuIiwiL3dlYi9zcmMvZmVhdHVyZXMvbWFuYWdlLWNoYW5uZWwvQ2hhbm5lbEFjdGlvbnMudHN4IiwiL3dlYi9zcmMvZmVhdHVyZXMvbWFuYWdlLWNoYW5uZWwvUHJpb3JpdHlTZWxlY3QudHN4IiwiL3dlYi9ub2Rl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B,KAAK;EAC5D,iCAAO,KAAK,oDAAC,uCAAD,EAAgB,SAAS,QAAU;;;;UAAC,CAAC;EACjD,gCAAU,OAAO,6BAAO,eAAe,sBAAsB,GAAG,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAC;EAC1F,MAAM,wCACJ,iCAAO,KAAK,CAAC,CAAC,qBAAqB,iCAAiC;GAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,KAAK,EAAE;GAAG,MAAM,EAAE,UAAU,EAAE;EAAE,CAAC,CACvI;CACF,CAAC;AACH,CAAC","names":[],"ignoreList":[],"sources":["ChannelActions.test.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { fireEvent, render, screen, waitFor } from \"@testing-library/react\";\nimport type { ReactNode } from \"react\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\n\nimport type { Channel } from \"@/entities/channel\";\nimport { api } from \"@/shared/api\";\nimport \"@/shared/i18n\";\n\nimport { ChannelActions } from \"./ChannelActions\";\nimport { PrioritySelect } from \"./PrioritySelect\";\n\nconst CHANNEL: Channel = {\n  id: \"c1\", channel_id: \"@meo\", handle: \"@meo\", name: \"Mèo Lười\", status: \"following\", priority: 3,\n  auto_discovered: false, added_at: \"2026-11-21T12:00:00+00:00\", note: \"\", clips_7d: 2, avg_score: 7.5,\n};\nconst STATE = { data: { id: \"c1\", status: \"paused\", priority: 3 }, response: new Response() };\n\nfunction wrap(children: ReactNode) {\n  const client = new QueryClient({ defaultOptions: { mutations: { retry: false } } });\n  return <QueryClientProvider client={client}>{children}</QueryClientProvider>;\n}\n\nafterEach(() => vi.restoreAllMocks());\n\ndescribe(\"ChannelActions\", () => {\n  it(\"pauses, resumes and blocks through the matching endpoint\", async () => {\n    const post = vi.spyOn(api, \"POST\").mockResolvedValue(STATE);\n    const { rerender } = render(wrap(<ChannelActions channel={CHANNEL} />));\n    fireEvent.click(screen.getByRole(\"button\", { name: \"Pause\" }));\n    await waitFor(() => expect(post).toHaveBeenCalledWith(\"/api/v1/channels/{channel_id}:pause\", { params: { path: { channel_id: \"c1\" } } }));\n    rerender(wrap(<ChannelActions channel={{ ...CHANNEL, status: \"paused\" }} />));\n    fireEvent.click(screen.getByRole(\"button\", { name: \"Resume\" }));\n    await waitFor(() => expect(post).toHaveBeenLastCalledWith(\"/api/v1/channels/{channel_id}:follow\", expect.anything()));\n    fireEvent.click(screen.getByRole(\"button\", { name: \"Block\" }));\n    await waitFor(() => expect(post).toHaveBeenLastCalledWith(\"/api/v1/channels/{channel_id}:block\", expect.anything()));\n    rerender(wrap(<ChannelActions channel={{ ...CHANNEL, status: \"blocked\" }} />));\n    expect(screen.getByRole(\"button\", { name: \"Unblock\" })).toBeInTheDocument();\n  });\n\n  it(\"removes only after confirmation\", async () => {\n    const del = vi.spyOn(api, \"DELETE\").mockResolvedValue({ data: undefined, response: new Response(null, { status: 204 }) });\n    render(wrap(<ChannelActions channel={CHANNEL} />));\n    fireEvent.click(screen.getByRole(\"button\", { name: \"Remove\" }));\n    expect(del).not.toHaveBeenCalled();\n    expect(screen.getByText(\"Remove Mèo Lười?\")).toBeInTheDocument();\n    const buttons = screen.getAllByRole(\"button\", { name: \"Remove\" });\n    const confirm = buttons[buttons.length - 1];\n    if (confirm === undefined) throw new Error(\"no confirm button\");\n    fireEvent.click(confirm);\n    await waitFor(() => expect(del).toHaveBeenCalledWith(\"/api/v1/channels/{channel_id}\", { params: { path: { channel_id: \"c1\" } } }));\n  });\n\n  it(\"changes the priority\", async () => {\n    const patch = vi.spyOn(api, \"PATCH\").mockResolvedValue(STATE);\n    render(wrap(<PrioritySelect channel={CHANNEL} />));\n    fireEvent.change(screen.getByLabelText(\"Priority of Mèo Lười\"), { target: { value: \"5\" } });\n    await waitFor(() =>\n      expect(patch).toHaveBeenCalledWith(\"/api/v1/channels/{channel_id}\", { params: { path: { channel_id: \"c1\" } }, body: { priority: 5 } }),\n    );\n  });\n});\n"],"file":"/web/src/features/manage-channel/ChannelActions.test.tsx"}