diff --git a/tests/fixtures/page-with-invalid-product-version.md b/tests/fixtures/page-with-invalid-product-version.md new file mode 100644 index 0000000000..1d86c307fc --- /dev/null +++ b/tests/fixtures/page-with-invalid-product-version.md @@ -0,0 +1,7 @@ +--- +title: This is an article +intro: I am missing productVersions frontmatter +versions: + fpt: '*' + ghae: 'issue-foo' # Only issue- is allowed, per lib/all-versions.js +--- diff --git a/tests/unit/page.js b/tests/unit/page.js index 24dcc6d774..4fa5fd3ce7 100644 --- a/tests/unit/page.js +++ b/tests/unit/page.js @@ -794,6 +794,18 @@ describe('catches errors thrown in Page class', () => { await expect(getPage).rejects.toThrowError('versions') }) + test('invalid versions frontmatter', async () => { + async function getPage() { + return await Page.init({ + relativePath: 'page-with-invalid-product-version.md', + basePath: path.join(__dirname, '../fixtures'), + languageCode: 'en', + }) + } + + await expect(getPage).rejects.toThrowError('versions') + }) + test('English page with a version in frontmatter that its parent product is not available in', async () => { async function getPage() { return await Page.init({