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/settings/model.ts", {"importedNames":["currentValue","presetOf","sameValue","toPatch"]});


const VALUES = {
	detection: {
		ratio_small_channel: 3,
		debounce_s: 45,
		min_chat_score: .45
	},
	ai: { min_viral_score: 6 }
};
const PRESETS = [{
	name: "balanced",
	values: {
		ratio_small_channel: 3,
		debounce_s: 45,
		min_chat_score: .45
	}
}, {
	name: "aggressive",
	values: {
		ratio_small_channel: 2.4,
		debounce_s: 30,
		min_chat_score: .35
	}
}];
(0,__vite_ssr_import_0__.describe)("settings model", () => {
	(0,__vite_ssr_import_0__.it)("reads the draft first, then the saved value", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.currentValue)(VALUES, {}, "ai.min_viral_score")).toBe(6);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.currentValue)(VALUES, { "ai.min_viral_score": 8 }, "ai.min_viral_score")).toBe(8);
	});
	(0,__vite_ssr_import_0__.it)("builds a section patch", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.toPatch)({
			"ai.min_viral_score": 8,
			"ai.llm_model": "x",
			"live.max_sessions": 2
		})).toEqual({
			ai: {
				min_viral_score: 8,
				llm_model: "x"
			},
			live: { max_sessions: 2 }
		});
	});
	(0,__vite_ssr_import_0__.it)("derives the preset and falls back to custom when a knob is edited", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.presetOf)(VALUES, {}, PRESETS)).toBe("balanced");
		const aggressive = {
			"detection.ratio_small_channel": 2.4,
			"detection.debounce_s": 30,
			"detection.min_chat_score": .35
		};
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.presetOf)(VALUES, aggressive, PRESETS)).toBe("aggressive");
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.presetOf)(VALUES, { "detection.debounce_s": 50 }, PRESETS)).toBe("custom");
	});
	(0,__vite_ssr_import_0__.it)("compares lists by value", () => {
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.sameValue)(["a", "b"], ["a", "b"])).toBe(true);
		(0,__vite_ssr_import_0__.expect)((0,__vite_ssr_import_1__.sameValue)(["a"], ["b"])).toBe(false);
	});
});

//# vitestCache=W3siZmlsZSI6IjEiLCJpZCI6IjEiLCJpbXBvcnRzIjoiMiIsIm1hcHBpbmdzIjpmYWxzZSwiZGVwcyI6IjMiLCJkeW5hbWljRGVwcyI6IjQiLCJzdGF0aWNNb2NrcyI6bnVsbCwiaGFzQ292ZXJhZ2VEYXRhIjpmYWxzZX0sIkQ6L0dpdEh1Yi9WaWNlQ3V0L3dlYi9zcmMvZW50aXRpZXMvc2V0dGluZ3MvbW9kZWwudGVzdC50cyIseyJ1cmxzIjoiNSIsImlkcyI6IjYifSxbIjciLCI4Il0sW10sWyI3IiwiOCJdLHt9LCIvQGZzL0M6L1VzZXJzL0FkbWluL0FwcERhdGEvTG9jYWwvbnBtLWNhY2hlL19ucHgvNjljMzgxZjhhZDk0YjU3Ni9ub2RlX21vZHVsZXMvdml0ZXN0L2Rpc3QvaW5kZXguanMiLCIvd2ViL3NyYy9lbnRpdGllcy9zZXR0aW5ncy9tb2RlbC50cyJd
//# vitestSourceMap={"version":3,"mappings":"AAAA;AAEA;;;AAEA,MAAM,SAAS;CAAE,WAAW;EAAE,qBAAqB;EAAG,YAAY;EAAI,gBAAgB;CAAK;CAAG,IAAI,EAAE,iBAAiB,EAAE;AAAE;AACzH,MAAM,UAAU,CACd;CAAE,MAAM;CAAY,QAAQ;EAAE,qBAAqB;EAAG,YAAY;EAAI,gBAAgB;CAAK;AAAE,GAC7F;CAAE,MAAM;CAAc,QAAQ;EAAE,qBAAqB;EAAK,YAAY;EAAI,gBAAgB;CAAK;AAAE,CACnG;AAEA,mCAAS,wBAAwB;CAC/B,6BAAG,qDAAqD;EACtD,iCAAO,uCAAa,QAAQ,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;EAC7D,iCAAO,uCAAa,QAAQ,EAAE,sBAAsB,EAAE,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;CACxF,CAAC;CAED,6BAAG,gCAAgC;EACjC,iCAAO,kCAAQ;GAAE,sBAAsB;GAAG,gBAAgB;GAAK,qBAAqB;EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ;GAChG,IAAI;IAAE,iBAAiB;IAAG,WAAW;GAAI;GACzC,MAAM,EAAE,cAAc,EAAE;EAC1B,CAAC;CACH,CAAC;CAED,6BAAG,2EAA2E;EAC5E,iCAAO,mCAAS,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU;EACrD,MAAM,aAAa;GAAE,iCAAiC;GAAK,wBAAwB;GAAI,4BAA4B;EAAK;EACxH,iCAAO,mCAAS,QAAQ,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY;EAC/D,iCAAO,mCAAS,QAAQ,EAAE,wBAAwB,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ;CACjF,CAAC;CAED,6BAAG,iCAAiC;EAClC,iCAAO,oCAAU,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;EACnD,iCAAO,oCAAU,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK;CAC5C,CAAC;AACH,CAAC","names":[],"ignoreList":[],"sources":["model.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\n\nimport { currentValue, presetOf, sameValue, toPatch } from \"./model\";\n\nconst VALUES = { detection: { ratio_small_channel: 3, debounce_s: 45, min_chat_score: 0.45 }, ai: { min_viral_score: 6 } };\nconst PRESETS = [\n  { name: \"balanced\", values: { ratio_small_channel: 3, debounce_s: 45, min_chat_score: 0.45 } },\n  { name: \"aggressive\", values: { ratio_small_channel: 2.4, debounce_s: 30, min_chat_score: 0.35 } },\n];\n\ndescribe(\"settings model\", () => {\n  it(\"reads the draft first, then the saved value\", () => {\n    expect(currentValue(VALUES, {}, \"ai.min_viral_score\")).toBe(6);\n    expect(currentValue(VALUES, { \"ai.min_viral_score\": 8 }, \"ai.min_viral_score\")).toBe(8);\n  });\n\n  it(\"builds a section patch\", () => {\n    expect(toPatch({ \"ai.min_viral_score\": 8, \"ai.llm_model\": \"x\", \"live.max_sessions\": 2 })).toEqual({\n      ai: { min_viral_score: 8, llm_model: \"x\" },\n      live: { max_sessions: 2 },\n    });\n  });\n\n  it(\"derives the preset and falls back to custom when a knob is edited\", () => {\n    expect(presetOf(VALUES, {}, PRESETS)).toBe(\"balanced\");\n    const aggressive = { \"detection.ratio_small_channel\": 2.4, \"detection.debounce_s\": 30, \"detection.min_chat_score\": 0.35 };\n    expect(presetOf(VALUES, aggressive, PRESETS)).toBe(\"aggressive\");\n    expect(presetOf(VALUES, { \"detection.debounce_s\": 50 }, PRESETS)).toBe(\"custom\");\n  });\n\n  it(\"compares lists by value\", () => {\n    expect(sameValue([\"a\", \"b\"], [\"a\", \"b\"])).toBe(true);\n    expect(sameValue([\"a\"], [\"b\"])).toBe(false);\n  });\n});\n"],"file":"/web/src/entities/settings/model.test.ts"}