test(docs): split placed-image paths on either separator

The placer tests receive absolute paths; on Windows the POSIX-only
split kept the whole path as the basename. The windows-acl branch
already carries this fix from an earlier merge-forward.
This commit is contained in:
Huanqi Cao
2026-08-09 17:11:18 +08:00
parent 018009338b
commit 428f84f710

View File

@@ -148,7 +148,7 @@ describe('rewriteMarkdown', () => {
repoRoot: root, repoRoot: root,
repositoryRef: 'abc123', repositoryRef: 'abc123',
placeImage: (absPath) => { placeImage: (absPath) => {
const name = absPath.split('/').pop() ?? '' const name = absPath.split(/[\\/]/u).pop() ?? ''
placed.push(name) placed.push(name)
return `./${name}` return `./${name}`
}, },
@@ -167,7 +167,7 @@ describe('rewriteMarkdown', () => {
pages, pages,
repoRoot: root, repoRoot: root,
repositoryRef: 'abc123', repositoryRef: 'abc123',
placeImage: absPath => `./${absPath.split('/').pop() ?? ''}`, placeImage: absPath => `./${absPath.split(/[\\/]/u).pop() ?? ''}`,
})).toBe('![logo](./logo.svg#view)\n') })).toBe('![logo](./logo.svg#view)\n')
}) })