Skip to content

Commit 39dbb13

Browse files
remove original modules
1 parent 489e604 commit 39dbb13

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

apps/site/next-data/generators/__tests__/blogData.test.mjs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,22 @@ import generateBlogData from '@/next-data/generators/blogData.mjs';
55

66
let files = [];
77

8-
jest.mock('node:fs', () => {
9-
const originalFs = jest.requireActual('node:fs');
10-
return {
11-
...originalFs,
12-
createReadStream: jest.fn(filename => {
13-
const readable = new Readable();
14-
const file = files.find(f => filename.endsWith(normalize(f.path)));
15-
readable.push(`---\n`);
16-
file.frontMatterContent.forEach(line => readable.push(`${line}\n`));
17-
readable.push(`---\n`);
18-
readable.push(null);
19-
readable.close = () => {};
20-
return readable;
21-
}),
22-
};
23-
});
24-
25-
jest.mock('../../../next.helpers.mjs', () => {
26-
const originalHelpers = jest.requireActual('../../../next.helpers.mjs');
27-
return {
28-
...originalHelpers,
29-
getMarkdownFiles: () => Promise.resolve(files.map(file => file.path)),
30-
};
31-
});
8+
jest.mock('node:fs', () => ({
9+
createReadStream: jest.fn(filename => {
10+
const readable = new Readable();
11+
const file = files.find(f => filename.endsWith(normalize(f.path)));
12+
readable.push(`---\n`);
13+
file.frontMatterContent.forEach(line => readable.push(`${line}\n`));
14+
readable.push(`---\n`);
15+
readable.push(null);
16+
readable.close = () => {};
17+
return readable;
18+
}),
19+
}));
20+
21+
jest.mock('../../../next.helpers.mjs', () => ({
22+
getMarkdownFiles: () => Promise.resolve(files.map(file => file.path)),
23+
}));
3224

3325
describe('generateBlogData', () => {
3426
it('should return zero posts and only the default "all" category is no md file is found', async () => {

0 commit comments

Comments
 (0)