feat:docs translation + versioning 💥

This commit is contained in:
endiliey 2018-09-07 20:41:04 +08:00
parent 31d333b82f
commit 0f38ae3979
20 changed files with 1133 additions and 520 deletions

View file

@ -1,39 +1,24 @@
import genRoutesConfig from '@lib/load/routes';
import loadDocs from '@lib/load/docs';
import loadPages from '@lib/load/pages';
import path from 'path';
import loadSetup from '../loadSetup';
describe('genRoutesConfig', () => {
const pagesDir = path.join(__dirname, '__fixtures__', 'simple-pages');
const docsDir = path.join(__dirname, '__fixtures__', 'simple-docs');
test('website with pages and docs', async () => {
const props = {
docsData: await loadDocs(docsDir),
pagesData: await loadPages(pagesDir)
};
const routes = await genRoutesConfig(props);
expect(routes).toMatchSnapshot();
test('simple website', async () => {
const props = await loadSetup('simple');
await genRoutesConfig(props);
});
test('website with only pages', async () => {
const props = {
pagesData: await loadPages(pagesDir)
};
const routes = await genRoutesConfig(props);
expect(routes).toMatchSnapshot();
test('versioned website', async () => {
const props = await loadSetup('versioned');
await genRoutesConfig(props);
});
test('website with only docs', async () => {
const props = {
docsData: await loadDocs(docsDir)
};
const routes = await genRoutesConfig(props);
expect(routes).toMatchSnapshot();
test('versioned & translated website', async () => {
const props = await loadSetup('transversioned');
await genRoutesConfig(props);
});
test('website with no docs/pages', async () => {
const routes = await genRoutesConfig({});
expect(routes).toMatchSnapshot();
test('translated website', async () => {
const props = await loadSetup('translated');
await genRoutesConfig(props);
});
});