This commit is contained in:
Sarah Schneider 2021-03-17 10:30:16 -04:00
Родитель cd2a217a77
Коммит 5006cdaff2
3 изменённых файлов: 40 добавлений и 0 удалений

5
tests/fixtures/page-versioned-for-ghae-next.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,5 @@
---
title: Page versioned for next GitHub AE release
versions:
github-ae: 'next'
---

5
tests/fixtures/page-versioned-for-next-enterprise-release.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,5 @@
---
title: Page versioned for next Enterprise release
versions:
enterprise-server: '>=3.1'
---

Просмотреть файл

@ -190,6 +190,36 @@ describe('Page class', () => {
expect($.text()).not.toBe('This text should render on any actively supported version of Enterprise Server')
expect($.text()).toBe('This text should only render on non-Enterprise')
})
test('support next to-be-released Enterprise Server version in frontmatter', async () => {
// This fixture has `enterprise-server: '>=3.1'` hardcoded in the frontmatter
const page = await Page.init({
relativePath: 'page-versioned-for-next-enterprise-release.md',
basePath: path.join(__dirname, '../fixtures'),
languageCode: 'en'
})
// set version to 3.0
const context = {
currentVersion: 'enterprise-server@3.0',
currentLanguage: 'en'
}
await expect(() => { return page.render(context) }).not.toThrow()
})
test('support next GitHub AE version in frontmatter', async () => {
// This fixture has `github-ae: 'next'` hardcoded in the frontmatter
const page = await Page.init({
relativePath: 'page-versioned-for-ghae-next.md',
basePath: path.join(__dirname, '../fixtures'),
languageCode: 'en'
})
// set version to @latest
const context = {
currentVersion: 'github-ae@latest',
currentLanguage: 'en'
}
await expect(() => { return page.render(context) }).not.toThrow()
})
})
test('preserves `languageCode`', async () => {