mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 03:12:35 +02:00
test: improve test coverage (#7181)
This commit is contained in:
parent
44966e19e9
commit
f219a2ac90
7 changed files with 48 additions and 14 deletions
|
@ -132,5 +132,10 @@ describe('<Interpolate>', () => {
|
|||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"The Docusaurus <Interpolate> component only accept simple string values. Received: React element"`,
|
||||
);
|
||||
expect(() =>
|
||||
renderer.create(<Interpolate>{null}</Interpolate>),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"The Docusaurus <Interpolate> component only accept simple string values. Received: object"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -63,6 +63,20 @@ exports[`loadPlugins loads plugins 1`] = `
|
|||
},
|
||||
},
|
||||
],
|
||||
"pluginsRouteConfigs": [],
|
||||
"pluginsRouteConfigs": [
|
||||
{
|
||||
"component": "Comp",
|
||||
"context": {
|
||||
"data": {
|
||||
"content": "path",
|
||||
},
|
||||
"plugin": "<PROJECT_ROOT>/packages/docusaurus/src/server/plugins/__tests__/__fixtures__/site-with-plugin/.docusaurus/test1/default/plugin-route-context-module-100.json",
|
||||
},
|
||||
"modules": {
|
||||
"content": "path",
|
||||
},
|
||||
"path": "foo/",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -31,6 +31,12 @@ describe('loadPlugins', () => {
|
|||
return this.prop;
|
||||
},
|
||||
async contentLoaded({content, actions}) {
|
||||
actions.addRoute({
|
||||
path: 'foo',
|
||||
component: 'Comp',
|
||||
modules: {content: 'path'},
|
||||
context: {content: 'path'},
|
||||
});
|
||||
actions.setGlobalData({content, prop: this.prop});
|
||||
},
|
||||
}),
|
||||
|
|
|
@ -129,6 +129,9 @@ describe('loadPresets', () => {
|
|||
path.join(__dirname, '__fixtures__/presets/preset-plugins.js'),
|
||||
{docs: {path: '../'}},
|
||||
],
|
||||
false,
|
||||
null,
|
||||
undefined,
|
||||
path.join(__dirname, '__fixtures__/presets/preset-themes.js'),
|
||||
path.join(__dirname, '__fixtures__/presets/preset-mixed.js'),
|
||||
],
|
||||
|
|
|
@ -272,9 +272,8 @@ ${JSON.stringify(routeConfig)}`,
|
|||
res.routesChunkNames[`${routePath}-${routeHash}`] = {
|
||||
// Avoid clash with a prop called "component"
|
||||
...genChunkNames({__comp: component}, 'component', component, res),
|
||||
...(context
|
||||
? genChunkNames({__context: context}, 'context', routePath, res)
|
||||
: {}),
|
||||
...(context &&
|
||||
genChunkNames({__context: context}, 'context', routePath, res)),
|
||||
...genChunkNames(modules, 'module', routePath, res),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue