mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 12:22:45 +02:00
feat: add siteConfig loader
This commit is contained in:
parent
06faff3474
commit
94c45e36cb
11 changed files with 4726 additions and 51 deletions
6
test/loader/__fixtures__/custom/.blogi/config.js
Normal file
6
test/loader/__fixtures__/custom/.blogi/config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
title: 'Hello World',
|
||||
description: 'Hello World',
|
||||
dest: 'blogi',
|
||||
base: 'blogi'
|
||||
};
|
5
test/loader/__fixtures__/custom/hello.md
Normal file
5
test/loader/__fixtures__/custom/hello.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Hello, World !
|
||||
---
|
||||
|
||||
Hello World
|
4
test/loader/__fixtures__/simple/.blogi/config.js
Normal file
4
test/loader/__fixtures__/simple/.blogi/config.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
title: 'Hello World',
|
||||
description: 'Hello World'
|
||||
};
|
5
test/loader/__fixtures__/simple/hello.md
Normal file
5
test/loader/__fixtures__/simple/hello.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Hello, World !
|
||||
---
|
||||
|
||||
Hello World
|
28
test/loader/config.test.js
Normal file
28
test/loader/config.test.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const loadConfig = require('../../lib/loader/config');
|
||||
|
||||
describe('loadConfig', () => {
|
||||
const simpleDir = path.join(__dirname, '__fixtures__', 'simple');
|
||||
const customDir = path.join(__dirname, '__fixtures__', 'custom');
|
||||
|
||||
test('simple', () => {
|
||||
expect(loadConfig(simpleDir)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"description": "Hello World",
|
||||
"title": "Hello World",
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
test('custom', () => {
|
||||
expect(loadConfig(customDir)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"base": "blogi",
|
||||
"description": "Hello World",
|
||||
"dest": "blogi",
|
||||
"title": "Hello World",
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue