Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

1.7 KB
Raw Blame
import { expect, it } from "vitest";

import { renderBusinessResult } from "./business-render.js";
import { renderConnectorResult } from "./connector-runtime.js";

const result = (name: string, identityLabel: string) => ({
  account: {
    connectionId: "external_connection_one",
    name,
    displayName: name,
    identityLabel,
  },
  result: {},
});

it("marks an Outlook label as the sign-in name, not the mailbox", () => {
  expect(
    renderConnectorResult(result("outlook", "[email protected]")).split("\n")[0],
  ).toBe(
    "Account: [email protected] - Microsoft sign-in name, the mailbox address may differ (external_connection_one)",
  );
});

it("prints another provider's identity label as it is", () => {
  expect(
    renderConnectorResult(result("gmail", "[email protected]")).split("\n")[0],
  ).toBe("Account: [email protected] (external_connection_one)");
});

it("marks only Outlook identities in the apps list", () => {
  const lines = renderBusinessResult("apps list", {
    connections: [
      {
        connectionId: "external_connection_one",
        name: "outlook",
        displayName: "Outlook Mail",
        identityLabel: "[email protected]",
      },
      {
        connectionId: "external_connection_two",
        name: "gmail",
        displayName: "Gmail",
        identityLabel: "[email protected]",
      },
    ],
  }).split("\n");
  expect(
    lines.find((line) => line.includes("external_connection_one")),
  ).toContain(
    "[email protected] - Microsoft sign-in name, the mailbox address may differ",
  );
  const gmail = lines.find((line) => line.includes("external_connection_two"));
  expect(gmail).toContain("[email protected]");
  expect(gmail).not.toContain("Microsoft sign-in name");
});