const __vite_ssr_import_0__ = await __vite_ssr_import__("/@fs/C:/Users/Admin/AppData/Local/npm-cache/_npx/69c381f8ad94b576/node_modules/vitest/dist/index.js", {"importedNames":["describe","expect","it"]});
const __vite_ssr_import_1__ = await __vite_ssr_import__("/web/src/entities/found-video/arrange.ts", {"importedNames":["arrangeVideos"]});


function video(id, over) {
	return {
		video_id: id,
		url: "",
		title: id,
		channel_name: "",
		channel_handle: "",
		duration_s: 3600,
		views: 0,
		published_at: "2026-11-26T10:00:00Z",
		was_live: false,
		views_per_hour: 0,
		from_followed: false,
		...over
	};
}
const VIDEOS = [
	video("old-long-live", {
		published_at: "2026-11-20T00:00:00Z",
		duration_s: 9e3,
		was_live: true,
		views_per_hour: 10
	}),
	video("new-hot", {
		published_at: "2026-11-26T00:00:00Z",
		views_per_hour: 900,
		from_followed: true
	}),
	video("mid", {
		published_at: "2026-11-23T00:00:00Z",
		duration_s: 5e3,
		views_per_hour: 100
	})
];
(0,__vite_ssr_import_0__.describe)("arrangeVideos", () => {
	(0,__vite_ssr_import_0__.it)("sorts by views per hour, date or length", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "trending", "all").map((v) => v.video_id)).toEqual([
			"new-hot",
			"mid",
			"old-long-live"
		]);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "newest", "all").map((v) => v.video_id)).toEqual([
			"new-hot",
			"mid",
			"old-long-live"
		]);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "longest", "all").map((v) => v.video_id)).toEqual([
			"old-long-live",
			"mid",
			"new-hot"
		]);
	});
	(0,__vite_ssr_import_0__.it)("keeps one kind: followed channels, live replays or uploads", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "trending", "followed").map((v) => v.video_id)).toEqual(["new-hot"]);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "trending", "live").map((v) => v.video_id)).toEqual(["old-long-live"]);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.arrangeVideos)(VIDEOS, "trending", "upload")).toHaveLength(2);
	});
});

//# vitestCache=W3siZmlsZSI6IjEiLCJpZCI6IjEiLCJpbXBvcnRzIjoiMiIsIm1hcHBpbmdzIjpmYWxzZSwiZGVwcyI6IjMiLCJkeW5hbWljRGVwcyI6IjQiLCJzdGF0aWNNb2NrcyI6bnVsbCwiaGFzQ292ZXJhZ2VEYXRhIjpmYWxzZX0sIkQ6L0dpdEh1Yi9WaWNlQ3V0L3dlYi9zcmMvZW50aXRpZXMvZm91bmQtdmlkZW8vYXJyYW5nZS50ZXN0LnRzIix7InVybHMiOiI1IiwiaWRzIjoiNiJ9LFsiNyIsIjgiXSxbXSxbIjciLCI4Il0se30sIi9AZnMvQzovVXNlcnMvQWRtaW4vQXBwRGF0YS9Mb2NhbC9ucG0tY2FjaGUvX25weC82OWMzODFmOGFkOTRiNTc2L25vZGVfbW9kdWxlcy92aXRlc3QvZGlzdC9pbmRleC5qcyIsIi93ZWIvc3JjL2VudGl0aWVzL2ZvdW5kLXZpZGVvL2FycmFuZ2UudHMiXQ==
//# vitestSourceMap={"version":3,"mappings":"AAAA;AAGA;;;AAEA,SAAS,MAAM,IAAY,MAAuC;CAChE,OAAO;EACL,UAAU;EAAI,KAAK;EAAI,OAAO;EAAI,cAAc;EAAI,gBAAgB;EAAI,YAAY;EAAM,OAAO;EACjG,cAAc;EAAwB,UAAU;EAAO,gBAAgB;EAAG,eAAe;EAAO,GAAG;CACrG;AACF;AAEA,MAAM,SAAS;CACb,MAAM,iBAAiB;EAAE,cAAc;EAAwB,YAAY;EAAM,UAAU;EAAM,gBAAgB;CAAG,CAAC;CACrH,MAAM,WAAW;EAAE,cAAc;EAAwB,gBAAgB;EAAK,eAAe;CAAK,CAAC;CACnG,MAAM,OAAO;EAAE,cAAc;EAAwB,YAAY;EAAM,gBAAgB;CAAI,CAAC;AAC9F;AAEA,mCAAS,uBAAuB;CAC9B,6BAAG,iDAAiD;EAClD,iCAAO,wCAAc,QAAQ,YAAY,KAAK,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ;GAAC;GAAW;GAAO;EAAe,CAAC;EACnH,iCAAO,wCAAc,QAAQ,UAAU,KAAK,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ;GAAC;GAAW;GAAO;EAAe,CAAC;EACjH,iCAAO,wCAAc,QAAQ,WAAW,KAAK,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ;GAAC;GAAiB;GAAO;EAAS,CAAC;CACpH,CAAC;CAED,6BAAG,oEAAoE;EACrE,iCAAO,wCAAc,QAAQ,YAAY,UAAU,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;EAChG,iCAAO,wCAAc,QAAQ,YAAY,MAAM,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;EAClG,iCAAO,wCAAc,QAAQ,YAAY,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;CACpE,CAAC;AACH,CAAC","names":[],"ignoreList":[],"sources":["arrange.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\n\nimport type { FoundVideo } from \"./api\";\nimport { arrangeVideos } from \"./arrange\";\n\nfunction video(id: string, over: Partial<FoundVideo>): FoundVideo {\n  return {\n    video_id: id, url: \"\", title: id, channel_name: \"\", channel_handle: \"\", duration_s: 3600, views: 0,\n    published_at: \"2026-11-26T10:00:00Z\", was_live: false, views_per_hour: 0, from_followed: false, ...over,\n  };\n}\n\nconst VIDEOS = [\n  video(\"old-long-live\", { published_at: \"2026-11-20T00:00:00Z\", duration_s: 9000, was_live: true, views_per_hour: 10 }),\n  video(\"new-hot\", { published_at: \"2026-11-26T00:00:00Z\", views_per_hour: 900, from_followed: true }),\n  video(\"mid\", { published_at: \"2026-11-23T00:00:00Z\", duration_s: 5000, views_per_hour: 100 }),\n];\n\ndescribe(\"arrangeVideos\", () => {\n  it(\"sorts by views per hour, date or length\", () => {\n    expect(arrangeVideos(VIDEOS, \"trending\", \"all\").map((v) => v.video_id)).toEqual([\"new-hot\", \"mid\", \"old-long-live\"]);\n    expect(arrangeVideos(VIDEOS, \"newest\", \"all\").map((v) => v.video_id)).toEqual([\"new-hot\", \"mid\", \"old-long-live\"]);\n    expect(arrangeVideos(VIDEOS, \"longest\", \"all\").map((v) => v.video_id)).toEqual([\"old-long-live\", \"mid\", \"new-hot\"]);\n  });\n\n  it(\"keeps one kind: followed channels, live replays or uploads\", () => {\n    expect(arrangeVideos(VIDEOS, \"trending\", \"followed\").map((v) => v.video_id)).toEqual([\"new-hot\"]);\n    expect(arrangeVideos(VIDEOS, \"trending\", \"live\").map((v) => v.video_id)).toEqual([\"old-long-live\"]);\n    expect(arrangeVideos(VIDEOS, \"trending\", \"upload\")).toHaveLength(2);\n  });\n});\n"],"file":"/web/src/entities/found-video/arrange.test.ts"}