1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/tests/rendering/products.js
Grace Park ef2efb0636 Feature Branch: Global Nav Phase 1 (#33465)
Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com>
Co-authored-by: Joe Oak <41307427+joeoak@users.noreply.github.com>
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2023-01-31 17:49:50 +00:00

26 lines
860 B
JavaScript

import { describe, jest } from '@jest/globals'
import { getJSON } from '../helpers/e2etest.js'
import nonEnterpriseDefaultVersion from '../../lib/non-enterprise-default-version.js'
describe('products middleware', () => {
jest.setTimeout(5 * 60 * 1000)
test('adds res.context.activeProducts array', async () => {
const products = await getJSON('/en?json=activeProducts')
expect(Array.isArray(products)).toBe(true)
})
test('adds res.context.currentProduct string on homepage', async () => {
const currentProduct = await getJSON('/en?json=currentProduct')
expect(currentProduct).toBe('homepage')
})
test('adds res.context.currentProduct object', async () => {
const currentProduct = await getJSON(
`/en/${nonEnterpriseDefaultVersion}/actions?json=currentProduct`
)
expect(currentProduct).toBe('actions')
})
})