fill method infrastructure ✓ 84.6%

Last updated: 2026-03-04T23:21:38.385Z

Metrics

LOC: 26 Complexity: 5 Params: 2 Coverage: 84.6% (11/13 lines, 5x executed)

Signature

fill(wrapper: HTMLElement, value: string): : boolean

Source Code

  fill(wrapper: HTMLElement, value: string): boolean {
    const stars = wrapper.querySelectorAll<HTMLElement>(".ant-rate-star");
    if (stars.length === 0) return false;

    let target = parseInt(value, 10);
    if (isNaN(target) || target < 1) {
      // Random value between 3 and total
      target = Math.max(3, Math.floor(Math.random() * stars.length) + 1);
    }

    // Clamp to range
    target = Math.min(target, stars.length);

    // Click the target star (1-indexed → 0-indexed)
    const star = stars[target - 1];
    const clickTarget = star.querySelector<HTMLElement>(
      ".ant-rate-star-second",
    );
    if (clickTarget) {
      simulateClick(clickTarget);
      return true;
    }

    simulateClick(star);
    return true;
  },

Dependencies (Outgoing)

graph LR fill["fill"] simulateClick["simulateClick"] fill -->|calls| simulateClick style fill fill:#dbeafe,stroke:#2563eb,stroke-width:2px click fill "ae7a3135e63d7d71.html" click simulateClick "7c6c21320aaee4c4.html"
TargetType
simulateClick calls

No incoming dependencies.