1
0
mirror of synced 2025-12-25 02:17:36 -05:00

no longer need the middleware in tests

This commit is contained in:
Sarah Schneider
2021-05-21 12:32:05 -04:00
parent 1945b8a3d4
commit 8b6e5f30f7

View File

@@ -5,7 +5,6 @@ const { loadSiteTree } = require('../../lib/page-data')
const loadData = require('../../lib/site-data')
const japaneseCharacters = require('japanese-characters')
const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version')
const renderTreeTitlesMiddleware = require('../../middleware/contextualizers/render-tree-titles')
describe('siteTree', () => {
jest.setTimeout(3 * 60 * 1000)
@@ -45,6 +44,7 @@ describe('siteTree', () => {
const ghesSiteTree = siteTree.en[ghesLatest]
// Find a page in the tree that we know contains Liquid
// TODO: use new findPageInSiteTree helper when it's available
const pageWithDynamicTitle = ghesSiteTree
.childPages.find(child => child.href === `/en/${ghesLatest}/admin`)
.childPages.find(child => child.href === `/en/${ghesLatest}/admin/enterprise-support`)
@@ -52,20 +52,6 @@ describe('siteTree', () => {
// Confirm the raw title contains Liquid
expect(pageWithDynamicTitle.page.title).toEqual('Working with {% data variables.contact.github_support %}')
// Create a req so we can apply middleware
const req = {
context: {
page: ghesSiteTree.childPages[0].page, // this can be any non-homepage page
siteTree,
currentLanguage: 'en',
currentVersion: ghesLatest,
site: siteData.en.site
}
}
// Pass the test req and an empty res and next
await renderTreeTitlesMiddleware(req, {}, () => {})
// Confirm a new property contains the rendered title
expect(pageWithDynamicTitle.renderedFullTitle).toEqual('Working with GitHub Support')
})