@rimelight/seo 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/og.test.ts +48 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/seo",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment's SEO Package",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -73,7 +73,7 @@
73
73
  "access": "public"
74
74
  },
75
75
  "devDependencies": {
76
- "@rimelight/config": "0.0.12",
76
+ "@rimelight/config": "0.0.13",
77
77
  "astro": "7.3.3",
78
78
  "sharp": "^0.35.4",
79
79
  "typescript": "6.0.3"
@@ -92,7 +92,7 @@
92
92
  }
93
93
  },
94
94
  "engines": {
95
- "node": ">=26.9.0"
95
+ "node": ">=26.8.2"
96
96
  },
97
97
  "scripts": {
98
98
  "build": "vp pack",
package/src/og.test.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { defaultOgLayout, NOTO_SANS } from "./og"
3
+
4
+ describe("@rimelight/seo defaultOgLayout", () => {
5
+ it("should construct default dark layout VNode with title and brand", () => {
6
+ const vnode: any = defaultOgLayout({
7
+ title: "My Amazing Blog Post",
8
+ brand: "Rimelight",
9
+ badge: "Blog",
10
+ description: "A deep dive into testing and safety."
11
+ })
12
+
13
+ expect(vnode.type).toBe("div")
14
+ expect(vnode.props.style.backgroundColor).toBe("#0a0a0a")
15
+ expect(vnode.props.style.fontFamily).toBe(NOTO_SANS.name)
16
+ expect(vnode.props.children).toHaveLength(3) // brand row, content row, footer row
17
+ })
18
+
19
+ it("should truncate overly long titles and descriptions safely", () => {
20
+ const longTitle = "A".repeat(200)
21
+ const longDesc = "B".repeat(300)
22
+
23
+ const vnode: any = defaultOgLayout({
24
+ title: longTitle,
25
+ description: longDesc
26
+ })
27
+
28
+ const titleNode = vnode.props.children[1].props.children[0]
29
+ const descNode = vnode.props.children[1].props.children[1]
30
+
31
+ expect(titleNode.props.children.length).toBe(160)
32
+ expect(titleNode.props.children.endsWith("\u2026")).toBe(true)
33
+ expect(descNode.props.children.length).toBe(240)
34
+ expect(descNode.props.children.endsWith("\u2026")).toBe(true)
35
+ })
36
+
37
+ it("should support gradient background and preview overlay", () => {
38
+ const vnode: any = defaultOgLayout({
39
+ title: "Preview Post",
40
+ background: "gradient",
41
+ preview: true
42
+ })
43
+
44
+ expect(vnode.props.style.background).toContain("linear-gradient")
45
+ // Contains previewOverlay and previewLabel
46
+ expect(vnode.props.children.some((c: any) => c?.props?.children === "PREVIEW")).toBe(true)
47
+ })
48
+ })