ConusAI vendor v0.1.0-dev.20261027+9b1131fb
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261027+9b1131fb
2026-10-27 18:05:17 +00:00
commit 3102273ec7
538 changed files with 80203 additions and 0 deletions
@@ -0,0 +1,66 @@
// Which logo a theme shows when an organization has uploaded one, both, or none: the one rule the
// layout, the settings page, the share image and the email all read (contract/logo.ts).
import { describe, expect, it } from "vitest"
import { logoUrl, resolveLogo, tenantLogo } from "../contract/logo.js"
const light = "/acme/brand/logo/light?v=aaaaaaaaaaaaaaaa"
const dark = "/acme/brand/logo/dark?v=bbbbbbbbbbbbbbbb"
const app = { light: "/app-light.svg", dark: "/app-dark.svg" }
describe("the logo an organization shows on a theme", () => {
it("is its own when it has one for that theme", () => {
const both = { logoLight: light, logoDark: dark }
expect(tenantLogo(both, "light")).toEqual({ source: "tenant", variant: "light", path: light })
expect(tenantLogo(both, "dark")).toEqual({ source: "tenant", variant: "dark", path: dark })
})
it("is the only one it has, on both themes", () => {
expect(tenantLogo({ logoLight: light, logoDark: null }, "dark")).toEqual({
source: "tenant",
variant: "light",
path: light,
})
expect(tenantLogo({ logoLight: null, logoDark: dark }, "light")).toEqual({
source: "tenant",
variant: "dark",
path: dark,
})
expect(tenantLogo({ logoLight: light, logoDark: null }, "light")?.variant).toBe("light")
})
it("is none when it has none", () => {
expect(tenantLogo({ logoLight: null, logoDark: null }, "dark")).toBeNull()
})
})
describe("the logo a share image or an email shows", () => {
it("is the organization's, with the same fallback between its two", () => {
expect(resolveLogo({ logoLight: light, logoDark: null }, app, "dark")).toEqual({
source: "tenant",
variant: "light",
path: light,
})
expect(resolveLogo({ logoLight: light, logoDark: dark }, app, "dark")).toEqual({
source: "tenant",
variant: "dark",
path: dark,
})
})
it("is the app brand's own for that theme when the organization has none, or there is no organization", () => {
expect(resolveLogo({ logoLight: null, logoDark: null }, app, "dark")).toEqual({
source: "app",
variant: "dark",
path: "/app-dark.svg",
})
expect(resolveLogo(null, app, "light")).toEqual({ source: "app", variant: "light", path: "/app-light.svg" })
})
})
describe("the address of a stored size", () => {
it("adds the size after the content tag", () => {
expect(logoUrl(light, "1x")).toBe(`${light}&s=1x`)
expect(logoUrl("/acme/brand/logo/light", "2x")).toBe("/acme/brand/logo/light?s=2x")
})
})