silverwolf-x/project / test /unit /recursive-readdir.test.ts
silverwolf-x's picture
download
raw
916 Bytes
/* eslint-env jest */
import { recursiveReadDir } from 'next/dist/lib/recursive-readdir'
import { join } from 'path'
const resolveDataDir = join(__dirname, 'isolated', '_resolvedata')
const dirWithPages = join(resolveDataDir, 'readdir', 'pages')
describe('recursiveReadDir', () => {
it('should work', async () => {
const result = await recursiveReadDir(dirWithPages, {
pathnameFilter: (f) => /\.js/.test(f),
})
const pages = [
/^[\\/]index\.js/,
/^[\\/]prefered\.js/,
/^[\\/]nav[\\/]about\.js/,
/^[\\/]nav[\\/]index\.js/,
/^[\\/]nested[\\/]index\.js/,
/^[\\/]prefered[\\/]index\.js/,
/^[\\/]nav[\\/]products[\\/]product\.js/,
]
expect(
result.filter((item) => {
for (const page of pages) {
if (page.test(item)) {
return false
}
}
return true
}).length
).toBe(0)
})
})

Xet Storage Details

Size:
916 Bytes
·
Xet hash:
c85f6c1af91f15f26f641e2588268e3993b04fb4f3544e872da65f2540800697

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.