1
0
mirror of synced 2025-12-26 05:02:55 -05:00
Files
docs/tests/rendering/signup-button.js
Peter Bengtsson 18504871b9 cache full rendering (#25424)
* cache full rendering

* still not working with gzip

* progress progress progress

* smaller

* hacky progress

* small fixes

* wip

* lock file

* wip

* wip

* package-lock updates

* wip

* search DOM in lowercase

* simplify

* with instrument

* improve test coverage

* mutateCheeriobodyByRequest

* fix

* remove renderContentCacheByContex

* disable render caching in sync-search

* diables things in github/github link checker

* gzip lru

* tidying up

* updated

* correct tests

* fix: move userLanguage to LanguagesContext

* Revert "fix: move userLanguage to LanguagesContext"

This reverts commit d7c05d958c71eaad496eb46764eb845d80b866ca.

* contexts ftw

* fixed rendering tests

* oops for got new file

* nits addressed

Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
2022-05-23 12:12:09 +00:00

32 lines
883 B
JavaScript

import { jest, describe, expect } from '@jest/globals'
import { getDOM } from '../helpers/e2etest.js'
import { getIsDotComAuthenticated } from '../helpers/script-data.js'
describe('GHEC sign up button', () => {
jest.setTimeout(60 * 1000)
test('false by default', async () => {
const $ = await getDOM('/en')
expect(getIsDotComAuthenticated($)).toBe(false)
})
test('not present if dotcom_user cookie', async () => {
const $ = await getDOM('/en', {
headers: {
cookie: 'dotcom_user=peterbe',
},
})
expect(getIsDotComAuthenticated($)).toBe(true)
// Do another request, same URL, but different cookie, just to
// make sure the server-side rendering cache isn't failing.
const $2 = await getDOM('/en', {
headers: {
cookie: 'bla=bla',
},
})
expect(getIsDotComAuthenticated($2)).toBe(false)
})
})