Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.2 kB ยท 43 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344import { expect } from "@std/expect";import { describe, test } from "@std/testing/bdd";
import { toAgentUser, toAttributedUserDetail } from "../attribution";
const row = { id: 7, name: null, firstName: "Ada", lastName: "Lovelace", email: "ada@example.com", photoUrl: "",};
describe("attribution projections", () => { test("detail carries email and normalizes an empty photo to null", () => { expect(toAttributedUserDetail(row)).toEqual({ id: 7, name: "Ada Lovelace", email: "ada@example.com", photoUrl: null, }); });
test("soft-deleted user exposes no contact details", () => { expect(toAttributedUserDetail({ ...row, deletedAt: new Date() })).toEqual({ id: 7, name: "Deleted user", email: null, photoUrl: null, }); });
test("agent projection drops email and photo", () => { const detail = toAttributedUserDetail({ ...row, photoUrl: "https://example.com/ada.png", }); expect(detail?.photoUrl).toBe("https://example.com/ada.png"); expect(toAgentUser(detail)).toEqual({ id: 7, name: "Ada Lovelace" }); expect(toAgentUser(null)).toBeNull(); });});