test(scripts): split placed-image paths on both separators in project-doc-site.spec.ts
The placer fixtures derive the basename with split('/'), which never splits a Windows absolute path (backslashes), so the two image-placement tests fail on win32 hosts. The production rewrite passes absolute paths through; the fixtures now accept both separators.
This commit is contained in:
@@ -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('\n')
|
})).toBe('\n')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user