import { describe, expect, it } from "vitest";

import { PlatformDetector } from "../platform-detect";

describe("PlatformDetector", () => {
  it("treats OnePlus PKC110 as an OPPO-family keyboard fallback device", () => {
    const ua =
      "Mozilla/5.0 (Linux; Android 15; OnePlus PKC110 Build/AP3A.240617.008; wv) " +
      "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 " +
      "Chrome/126.0.0.0 Mobile Safari/537.36 FBAN/FB4A";

    expect(PlatformDetector.isOppoFamilyDevice(ua)).toBe(true);
  });

  it("does not treat other OnePlus models as OPPO-family fallback devices", () => {
    const ua =
      "Mozilla/5.0 (Linux; Android 15; NE2210 Build/AP3A.240617.008; wv) " +
      "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 " +
      "Chrome/126.0.0.0 Mobile Safari/537.36 FBAN/FB4A";

    expect(PlatformDetector.isOppoFamilyDevice(ua)).toBe(false);
  });

  it("keeps OPPO CPH models as OPPO-family fallback devices", () => {
    const ua =
      "Mozilla/5.0 (Linux; Android 15; OPPO CPH2609 Build/AP3A.240617.008; wv) " +
      "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 " +
      "Chrome/126.0.0.0 Mobile Safari/537.36 FBAN/FB4A";

    expect(PlatformDetector.isOppoFamilyDevice(ua)).toBe(true);
  });
});
