Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

931 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { getSessionDeviceLabel } from "./get-session-device-label";

const t = (key: string, values?: Record<string, unknown>) =>
  values ? `${key}:${JSON.stringify(values)}` : key;

describe("getSessionDeviceLabel", () => {
  it("names browser and system together", () => {
    expect(getSessionDeviceLabel({ browser: "Firefox", os: "Linux" }, t)).toBe(
      'settings:sessions.device:{"browser":"Firefox","os":"Linux"}',
    );
  });

  it("falls back to whichever half is known", () => {
    expect(getSessionDeviceLabel({ browser: null, os: "iPhone" }, t)).toBe(
      "iPhone",
    );
    expect(getSessionDeviceLabel({ browser: "Safari", os: null }, t)).toBe(
      "Safari",
    );
  });

  it("says when the device is unknown", () => {
    expect(getSessionDeviceLabel({ browser: null, os: null }, t)).toBe(
      "settings:sessions.unknownDevice",
    );
  });
});