mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +02:00
test(v2): add unit test for migration of config file (#3323)
This commit is contained in:
parent
d299b99631
commit
a72ac91e3e
3 changed files with 185 additions and 0 deletions
|
@ -0,0 +1,82 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
title: 'Docusaurus',
|
||||||
|
tagline: 'Easy to Maintain Open Source Documentation Websites',
|
||||||
|
url: 'https://docusaurus.io',
|
||||||
|
baseUrl: '/',
|
||||||
|
organizationName: 'facebook',
|
||||||
|
projectName: 'docusaurus',
|
||||||
|
scripts: [
|
||||||
|
'https://buttons.github.io/buttons.js',
|
||||||
|
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
||||||
|
'/js/code-blocks-buttons.js',
|
||||||
|
],
|
||||||
|
favicon: 'img/docusaurus.ico',
|
||||||
|
customFields: {
|
||||||
|
users: {
|
||||||
|
caption: 'DevSpace',
|
||||||
|
image: '/img/users/devspace.svg',
|
||||||
|
infoLink: 'https://devspace.cloud/docs/',
|
||||||
|
fbOpenSource: false,
|
||||||
|
pinned: false,
|
||||||
|
},
|
||||||
|
translationRecruitingLink: 'https://crowdin.com/project/docusaurus',
|
||||||
|
facebookAppId: '199138890728411',
|
||||||
|
},
|
||||||
|
onBrokenLinks: 'log',
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@docusaurus/preset-classic',
|
||||||
|
{
|
||||||
|
docs: {
|
||||||
|
homePageId: 'installation',
|
||||||
|
showLastUpdateAuthor: true,
|
||||||
|
showLastUpdateTime: true,
|
||||||
|
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||||
|
},
|
||||||
|
blog: {},
|
||||||
|
theme: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
plugins: [],
|
||||||
|
themeConfig: {
|
||||||
|
navbar: {
|
||||||
|
title: 'Docusaurus',
|
||||||
|
logo: {src: 'img/docusaurus.svg'},
|
||||||
|
items: [
|
||||||
|
{to: 'docs/', label: 'Docs', position: 'left'},
|
||||||
|
{to: 'docs/tutorial-setup', label: 'Tutorial', position: 'left'},
|
||||||
|
{to: '/users', label: 'Users', position: 'left'},
|
||||||
|
{
|
||||||
|
href: 'https://github.com/facebook/docusaurus',
|
||||||
|
label: 'GitHub',
|
||||||
|
position: 'left',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
image: 'img/docusaurus.png',
|
||||||
|
footer: {
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
title: 'Community',
|
||||||
|
items: [{label: 'Twitter', to: 'https://twitter.com/docusaurus'}],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
copyright: 'Copyright © 2020 Facebook Inc.',
|
||||||
|
logo: {src: 'img/docusaurus_monochrome.svg'},
|
||||||
|
},
|
||||||
|
algolia: {
|
||||||
|
apiKey: '3eb9507824b8be89e7a199ecaa1a9d2c',
|
||||||
|
indexName: 'docusaurus',
|
||||||
|
algoliaOptions: {facetFilters: ['language:LANGUAGE', 'version:VERSION']},
|
||||||
|
},
|
||||||
|
gtag: {trackingID: 'UA-44373548-31'},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const users = {
|
||||||
|
caption: 'DevSpace',
|
||||||
|
image: '/img/users/devspace.svg',
|
||||||
|
infoLink: 'https://devspace.cloud/docs/',
|
||||||
|
fbOpenSource: false,
|
||||||
|
pinned: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
const siteConfig = {
|
||||||
|
title: 'Docusaurus',
|
||||||
|
tagline: 'Easy to Maintain Open Source Documentation Websites',
|
||||||
|
url: 'https://docusaurus.io',
|
||||||
|
baseUrl: '/',
|
||||||
|
organizationName: 'facebook',
|
||||||
|
projectName: 'docusaurus',
|
||||||
|
cname: 'docusaurus.io',
|
||||||
|
noIndex: false,
|
||||||
|
users,
|
||||||
|
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||||
|
headerLinks: [
|
||||||
|
{doc: 'installation', label: 'Docs'},
|
||||||
|
{doc: 'tutorial-setup', label: 'Tutorial'},
|
||||||
|
{page: 'users', label: 'Users'},
|
||||||
|
{blog: true, label: 'Blog'},
|
||||||
|
{
|
||||||
|
href: 'https://github.com/facebook/docusaurus',
|
||||||
|
label: 'GitHub',
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
headerIcon: 'img/docusaurus.svg',
|
||||||
|
footerIcon: 'img/docusaurus_monochrome.svg',
|
||||||
|
favicon: 'img/docusaurus.ico',
|
||||||
|
algolia: {
|
||||||
|
apiKey: '3eb9507824b8be89e7a199ecaa1a9d2c',
|
||||||
|
indexName: 'docusaurus',
|
||||||
|
algoliaOptions: {
|
||||||
|
facetFilters: ['language:LANGUAGE', 'version:VERSION'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
colors: {
|
||||||
|
primaryColor: '#2E8555',
|
||||||
|
secondaryColor: '#205C3B',
|
||||||
|
},
|
||||||
|
translationRecruitingLink: 'https://crowdin.com/project/docusaurus',
|
||||||
|
copyright: `Copyright © ${new Date().getFullYear()} Facebook Inc.`,
|
||||||
|
usePrism: ['jsx'],
|
||||||
|
highlight: {
|
||||||
|
theme: 'atom-one-dark',
|
||||||
|
},
|
||||||
|
scripts: [
|
||||||
|
'https://buttons.github.io/buttons.js',
|
||||||
|
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
||||||
|
'/js/code-blocks-buttons.js',
|
||||||
|
],
|
||||||
|
gaTrackingId: 'UA-44373548-31',
|
||||||
|
facebookAppId: '199138890728411',
|
||||||
|
facebookComments: true,
|
||||||
|
twitter: 'true',
|
||||||
|
twitterUsername: 'docusaurus',
|
||||||
|
ogImage: 'img/docusaurus.png',
|
||||||
|
twitterImage: 'img/docusaurus.png',
|
||||||
|
onPageNav: 'separate',
|
||||||
|
cleanUrl: true,
|
||||||
|
scrollToTop: true,
|
||||||
|
scrollToTopOptions: {
|
||||||
|
zIndex: 100,
|
||||||
|
},
|
||||||
|
enableUpdateTime: true,
|
||||||
|
enableUpdateBy: true,
|
||||||
|
docsSideNavCollapsible: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = siteConfig;
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import importFresh from 'import-fresh';
|
||||||
|
import {createConfigFile} from '../index';
|
||||||
|
|
||||||
|
describe('create config', () => {
|
||||||
|
test('simple test', () => {
|
||||||
|
const input = importFresh(`${__dirname}/__fixtures__/sourceSiteConfig.js`);
|
||||||
|
|
||||||
|
const result = createConfigFile(input);
|
||||||
|
|
||||||
|
const output = importFresh(
|
||||||
|
`${__dirname}/__fixtures__/expectedSiteConfig.js`,
|
||||||
|
);
|
||||||
|
expect(result).toEqual(output);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue