このコミットが含まれているのは:
@@ -4,7 +4,7 @@ import { vi } from 'vitest'
|
||||
|
||||
import source from '@/lib/help.ts?raw'
|
||||
|
||||
import type { ReactElement } from 'react'
|
||||
import type { ComponentType } from 'react'
|
||||
|
||||
import type * as Help from '@/lib/help'
|
||||
|
||||
@@ -38,11 +38,11 @@ export const createHelpFixture = () => {
|
||||
vi.fn (async () => `# ${title}\n\n${body}`)]))
|
||||
const moduleLoads = Object.fromEntries (published.map (([id, language, edition, title, body]) => [
|
||||
`../../help/${id}/editions/${language}/${edition}.mdx`,
|
||||
vi.fn (async (): Promise<{ default: () => ReactElement }> => ({
|
||||
vi.fn (async (): Promise<{ default: ComponentType }> => ({
|
||||
default: () => createElement ('div', null,
|
||||
createElement ('h1', null, title), createElement ('p', null, body)) }))]))
|
||||
// Dynamic imports reuse a module namespace even when called more than once.
|
||||
const caches: Record<string, { promise?: Promise<{ default: () => ReactElement }> }> = { }
|
||||
const caches: Record<string, { promise?: Promise<{ default: ComponentType }> }> = { }
|
||||
const modules = Object.fromEntries (Object.entries (moduleLoads).map (([path, load]) => {
|
||||
caches[path] = { }
|
||||
return [path, vi.fn (() => caches[path].promise ??= load ())]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする