Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/selector-benchmark-harness.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041import { describe, it } from "../test_support/bdd.ts";import { expect } from "../test_support/expect.ts";import * as fc from "fast-check";
import { resolveSelectorPolicy, type SelectorKind, selectorKinds } from "../lib/selector_policy.ts";
describe("selector feature flags", () => { it("enables all selector kinds by default", () => { const result = resolveSelectorPolicy({}); expect(result.ok).toBe(true); if (result.ok) expect(result.policy).toEqual({ css: true, xpath: true, accessibility: true }); });
it("rejects conflicting enable and disable entries", () => { const result = resolveSelectorPolicy({ enable: ["css"], disable: ["css"] }); expect(result).toEqual({ ok: false, problem: "conflicting_selector_kind", selector_kind: "css", }); });
it("rejects an empty selector policy", () => { const result = resolveSelectorPolicy({ disable: ["css", "xpath", "accessibility"] }); expect(result).toEqual({ ok: false, problem: "empty_selector_policy", selector_kind: null }); });
it("preserves the requested selector set for valid feature flag combinations", () => { fc.assert( fc.property(fc.subarray([...selectorKinds], { minLength: 1 }), (enabled) => { const result = resolveSelectorPolicy({ enable: enabled as SelectorKind[] }); expect(result.ok).toBe(true); if (!result.ok) return; for (const kind of selectorKinds) { expect(result.policy[kind]).toBe(enabled.includes(kind)); } }), ); });});