chore(v2): fix async tests (#2906)

This commit is contained in:
Sébastien Lorber 2020-06-08 19:10:13 +02:00 committed by GitHub
parent 66716d1619
commit 08359dd3ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 28 deletions

View file

@ -110,13 +110,13 @@ Array [
`;
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=
- foo/bar
- foo/baz
- hello
- ipsum
- lorem]
- lorem"
`;
exports[`versioned website content 1`] = `

View file

@ -45,7 +45,7 @@ test('site with wrong sidebar file', async () => {
const plugin = pluginContentDocs(context, {
sidebarPath,
});
return plugin.loadContent().catch((e) => expect(e).toMatchSnapshot());
await expect(plugin.loadContent()).rejects.toThrowErrorMatchingSnapshot();
});
describe('empty/no docs website', () => {

View file

@ -177,16 +177,16 @@ describe('simple site', () => {
routeBasePath,
};
return processMetadata({
source: 'invalid-id.md',
refDir: path.join(badSiteDir, 'docs'),
context,
options,
env,
}).catch((e) =>
expect(e).toMatchInlineSnapshot(
`[Error: Document id cannot include "/".]`,
),
await expect(
processMetadata({
source: 'invalid-id.md',
refDir: path.join(badSiteDir, 'docs'),
context,
options,
env,
}),
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Document id cannot include \\"/\\"."`,
);
});
@ -196,16 +196,16 @@ describe('simple site', () => {
routeBasePath,
};
return processMetadata({
source: 'invalid-slug.md',
refDir: path.join(badSiteDir, 'docs'),
context,
options,
env,
}).catch((e) =>
expect(e).toMatchInlineSnapshot(
`[Error: Document slug cannot include "/".]`,
),
await expect(
processMetadata({
source: 'invalid-slug.md',
refDir: path.join(badSiteDir, 'docs'),
context,
options,
env,
}),
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Document slug cannot include \\"/\\"."`,
);
});
});