import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";

const controller = readFileSync(
    new URL("../../assets/controllers/collection_carousel_controller.js", import.meta.url),
    "utf8",
);

test("the collection stays left-aligned on desktop and centers the active cuvee on mobile", () => {
    assert.match(controller, /focus:\s*0/u);
    assert.match(controller, /perPage:\s*3\.25/u);
    assert.match(controller, /1200:\s*\{[\s\S]*?perPage:\s*2\.25/u);
    assert.match(controller, /900:\s*\{[\s\S]*?perPage:\s*1\.25/u);
    assert.match(
        controller,
        /640:\s*\{[\s\S]*?focus:\s*"center"[\s\S]*?trimSpace:\s*false[\s\S]*?padding:\s*"0\.75rem"/u,
    );
});
