1
0
mirror of synced 2025-12-22 19:34:15 -05:00

Migrate 10 JavaScript files to TypeScript (#57971)

This commit is contained in:
Kevin Heis
2025-10-14 13:50:09 -07:00
committed by GitHub
parent 0cf4aabd12
commit a79730e268
10 changed files with 238 additions and 112 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, test } from 'vitest'
import cheerio from 'cheerio'
import { renderContent } from '@/content-render/index'
import type { Context } from '@/types'
const example = `
\`\`\`yaml annotate
@@ -131,7 +132,7 @@ on: [push]
`
// Create a mock context with pages for AUTOTITLE resolution
const mockPages = {
const mockPages: Record<string, { href: string; rawTitle: string }> = {
'/get-started/start-your-journey/hello-world': {
href: '/get-started/start-your-journey/hello-world',
rawTitle: 'Hello World',
@@ -147,7 +148,8 @@ on: [push]
currentVersion: 'free-pro-team@latest',
pages: mockPages,
redirects: {},
}
// Mock test object doesn't need all Context properties, using 'as unknown as' to bypass strict type checking
} as unknown as Context
const res = await renderContent(example, mockContext)
const $ = cheerio.load(res)