mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
chore(v2): fix async tests (#2906)
This commit is contained in:
parent
66716d1619
commit
08359dd3ca
4 changed files with 24 additions and 28 deletions
|
@ -39,11 +39,7 @@ describe('server utils', () => {
|
||||||
const css = await utils.minifyCss(testCss);
|
const css = await utils.minifyCss(testCss);
|
||||||
expect(css).toMatchSnapshot();
|
expect(css).toMatchSnapshot();
|
||||||
|
|
||||||
try {
|
await expect(utils.minifyCss(notCss)).rejects.toMatchSnapshot();
|
||||||
await utils.minifyCss(notCss);
|
|
||||||
} catch (error) {
|
|
||||||
expect(error).toMatchSnapshot();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('autoprefix css', async () => {
|
test('autoprefix css', async () => {
|
||||||
|
|
|
@ -110,13 +110,13 @@ Array [
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`site with wrong sidebar file 1`] = `
|
exports[`site with wrong sidebar file 1`] = `
|
||||||
[Error: Bad sidebars file. The document id 'goku' was used in the sidebar, but no document with this id could be found.
|
"Bad sidebars file. The document id 'goku' was used in the sidebar, but no document with this id could be found.
|
||||||
Available document ids=
|
Available document ids=
|
||||||
- foo/bar
|
- foo/bar
|
||||||
- foo/baz
|
- foo/baz
|
||||||
- hello
|
- hello
|
||||||
- ipsum
|
- ipsum
|
||||||
- lorem]
|
- lorem"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`versioned website content 1`] = `
|
exports[`versioned website content 1`] = `
|
||||||
|
|
|
@ -45,7 +45,7 @@ test('site with wrong sidebar file', async () => {
|
||||||
const plugin = pluginContentDocs(context, {
|
const plugin = pluginContentDocs(context, {
|
||||||
sidebarPath,
|
sidebarPath,
|
||||||
});
|
});
|
||||||
return plugin.loadContent().catch((e) => expect(e).toMatchSnapshot());
|
await expect(plugin.loadContent()).rejects.toThrowErrorMatchingSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('empty/no docs website', () => {
|
describe('empty/no docs website', () => {
|
||||||
|
|
|
@ -177,16 +177,16 @@ describe('simple site', () => {
|
||||||
routeBasePath,
|
routeBasePath,
|
||||||
};
|
};
|
||||||
|
|
||||||
return processMetadata({
|
await expect(
|
||||||
|
processMetadata({
|
||||||
source: 'invalid-id.md',
|
source: 'invalid-id.md',
|
||||||
refDir: path.join(badSiteDir, 'docs'),
|
refDir: path.join(badSiteDir, 'docs'),
|
||||||
context,
|
context,
|
||||||
options,
|
options,
|
||||||
env,
|
env,
|
||||||
}).catch((e) =>
|
}),
|
||||||
expect(e).toMatchInlineSnapshot(
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||||
`[Error: Document id cannot include "/".]`,
|
`"Document id cannot include \\"/\\"."`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -196,16 +196,16 @@ describe('simple site', () => {
|
||||||
routeBasePath,
|
routeBasePath,
|
||||||
};
|
};
|
||||||
|
|
||||||
return processMetadata({
|
await expect(
|
||||||
|
processMetadata({
|
||||||
source: 'invalid-slug.md',
|
source: 'invalid-slug.md',
|
||||||
refDir: path.join(badSiteDir, 'docs'),
|
refDir: path.join(badSiteDir, 'docs'),
|
||||||
context,
|
context,
|
||||||
options,
|
options,
|
||||||
env,
|
env,
|
||||||
}).catch((e) =>
|
}),
|
||||||
expect(e).toMatchInlineSnapshot(
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||||
`[Error: Document slug cannot include "/".]`,
|
`"Document slug cannot include \\"/\\"."`,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue