Files
market/server/og/skillOgSvg.test.ts
zeekay 661a6a28d5 rebrand: Bot Hub → Hanzo Market, white-label via @luxfi/brand schema
- Repo transferred hanzobot/hub → hanzoai/market (matches owned hanzo.market domain)
- npm package: bothub → @hanzoai/market, packages/bothub → packages/market
- bothub-schema → @hanzoai/market-schema
- CLI binary: bothub → market
- Brand: Bot Hub → Hanzo Market across ~95 user-facing surfaces (README, docs, k8s,
  Dockerfile, public/manifest.json, OG image, CLI banner, site config, theme)
- Brand-neutral white-label: src/brand/ owns BrandConfig + BrandTheme + loader,
  public/brands/<id>.json presets for hanzo, zoo, lux, pars, liquidity, generic
- BRAND_ID env at build picks default; ConfigMap-mounted brand.json overrides at runtime
- Legacy paths retained for compat: ~/.bothub, .bothubignore, /.well-known/bothub.json,
  bothub-theme localStorage key, LEGACY_HOSTS for hub.hanzo.bot/clawhub.ai
- Fixed broken sed-replace artifacts in packages/market/src/cli/botConfig.test.ts
- Drops Clawd/OpenClaw dead brand surface, keeps Clawdis* schema types and
  clawd skill directory paths (backward compat for installed bot products)
2026-05-29 13:46:09 -07:00

60 lines
2.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { buildSkillOgSvg } from './skillOgSvg'
describe('skill OG SVG', () => {
it('includes title, description, and labels', () => {
const svg = buildSkillOgSvg({
markDataUrl: 'data:image/png;base64,AAA=',
title: 'Discord Doctor',
description: 'Quick diagnosis and repair for Discord bot.',
ownerLabel: '@jhillock',
versionLabel: 'v1.2.3',
footer: 'hanzo.market/jhillock/discord-doctor',
})
expect(svg).toContain('Discord Doctor')
expect(svg).toContain('Quick diagnosis and repair')
expect(svg).toContain('@jhillock')
expect(svg).toContain('v1.2.3')
expect(svg).toContain('hanzo.market/jhillock/discord-doctor')
})
it('wraps long titles to avoid clipping', () => {
const svg = buildSkillOgSvg({
markDataUrl: 'data:image/png;base64,AAA=',
title: 'Excalidraw Flowchart',
description: 'Create Excalidraw flowcharts from descriptions.',
ownerLabel: '@swiftlysisngh',
versionLabel: 'v1.0.2',
footer: 'hanzo.market/swiftlysisngh/excalidraw-flowchart',
})
const titleBlock = svg.match(/<text[^>]*font-weight="800"[\s\S]*?<\/text>/)?.[0] ?? ''
const titleTspans = titleBlock.match(/<tspan /g) ?? []
expect(titleTspans.length).toBe(2)
expect(svg).toContain('Excalidraw')
expect(svg).toContain('Flowchart')
})
it('clips and wraps long descriptions', () => {
const longWord = 'a'.repeat(200)
const svg = buildSkillOgSvg({
markDataUrl: 'data:image/png;base64,AAA=',
title: 'Gurkerlcli',
description: `Prefix ${longWord} suffix`,
ownerLabel: '@pasogott',
versionLabel: 'v0.1.0',
footer: 'hanzo.market/pasogott/gurkerlcli',
})
expect(svg).toContain('<clipPath id="cardClip">')
expect(svg).toContain('clip-path="url(#cardClip)"')
expect(svg).not.toContain(longWord)
expect(svg).toContain('…')
const descBlock = svg.match(/<text[^>]*font-size="26"[\s\S]*?<\/text>/)?.[0] ?? ''
const descTspans = descBlock.match(/<tspan /g) ?? []
expect(descTspans.length).toBeLessThanOrEqual(3)
})
})