mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
fix: do not hardcode siteConfig path (#1150)
* Fix broken build Do not hardcode path in require to siteConfig * Just require instead of loadConfig * Actually use loadConfig I think the test may be wrong too. * refactor & nits * jest mock to fix test * fix test
This commit is contained in:
parent
71824a3541
commit
c78a8b4262
5 changed files with 19 additions and 11 deletions
|
@ -10,6 +10,10 @@ const blog = require('../blog');
|
|||
const metadataUtils = require('../metadataUtils');
|
||||
const {replaceAssetsLink} = require('../utils.js');
|
||||
|
||||
jest.mock(`${process.cwd()}/siteConfig.js`, () => ({baseUrl: '/'}), {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
const testFile = path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
|
@ -76,7 +80,7 @@ describe('replaceAssetsLink', () => {
|
|||
'utf8',
|
||||
);
|
||||
const rawContent1 = metadataUtils.extractMetadata(doc1).rawContent;
|
||||
const content1 = replaceAssetsLink(rawContent1, 'blog');
|
||||
const content1 = replaceAssetsLink(rawContent1, '/blog');
|
||||
expect(content1).toMatchSnapshot();
|
||||
expect(content1).toContain('');
|
||||
expect(content1).toContain('');
|
||||
|
@ -95,7 +99,7 @@ describe('replaceAssetsLink', () => {
|
|||
'utf8',
|
||||
);
|
||||
const rawContent2 = metadataUtils.extractMetadata(doc2).rawContent;
|
||||
const content2 = replaceAssetsLink(rawContent2, 'blog');
|
||||
const content2 = replaceAssetsLink(rawContent2, '/blog');
|
||||
expect(content2).toMatchSnapshot();
|
||||
expect(content2).not.toContain('');
|
||||
expect(content2).not.toContain('');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue