File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
apps/site/next-data/generators/__tests__ Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 1+ import { normalize } from 'node:path' ;
12import { Readable } from 'node:stream' ;
23
34import generateBlogData from '@/next-data/generators/blogData.mjs' ;
45
56let files = [ ] ;
67
7- jest . mock ( 'node:path' , ( ) => ( {
8- ...jest . requireActual ( 'node:path' ) ,
9- join : jest . fn ( ( _base , filePath ) => filePath ) ,
10- } ) ) ;
11-
128jest . mock ( 'node:fs' , ( ) => {
139 const originalFs = jest . requireActual ( 'node:fs' ) ;
1410 return {
1511 ...originalFs ,
1612 createReadStream : jest . fn ( filename => {
1713 const readable = new Readable ( ) ;
18- const file = files . find ( f => f . path === filename ) ;
14+ const file = files . find ( f => filename . endsWith ( normalize ( f . path ) ) ) ;
1915 readable . push ( `---\n` ) ;
2016 file . frontMatterContent . forEach ( line => readable . push ( `${ line } \n` ) ) ;
2117 readable . push ( `---\n` ) ;
You can’t perform that action at this time.
0 commit comments