import { describe, expect, it } from "vitest";
import { buildScenarioRequestBody } from "./scenario-request";

describe("buildScenarioRequestBody", () => {
  it("includes Turnstile and fingerprint signals for anonymous easy mode", () => {
    expect(
      buildScenarioRequestBody({
        platform: "aks",
        difficulty: "easy",
        viewer: null,
        fingerprintHash: "fp_hash",
        turnstileToken: "ts_token",
      })
    ).toEqual({
      platform: "aks",
      difficulty: "easy",
      fingerprintHash: "fp_hash",
      turnstileToken: "ts_token",
    });
  });

  it("omits anonymous verification fields for GitHub viewers", () => {
    expect(
      buildScenarioRequestBody({
        platform: "aro-hcp",
        difficulty: "hard",
        viewer: {
          kind: "github",
          githubUserId: "12345",
          githubLogin: "octocat",
          displayName: "The Octocat",
          avatarUrl: null,
        },
        fingerprintHash: "fp_hash",
        turnstileToken: "ts_token",
      })
    ).toEqual({
      platform: "aro-hcp",
      difficulty: "hard",
    });
  });
});
