* Move CSRF response back to XHR * Update events.js * Pass through cookieJar * Enable session route test * Skip next x csrf test * Add other fields to endpoint for future issues * Remove client side parts * Revert test skip * Use nested router pattern * ugh forgot a file * Update naming * Update tests/rendering/session.js Co-authored-by: Peter Bengtsson <peterbe@github.com> * Updating to use cache control * Use req.langauge and req.userLanguage Co-authored-by: Peter Bengtsson <peterbe@github.com>
16 lines
536 B
JavaScript
16 lines
536 B
JavaScript
import { jest } from '@jest/globals'
|
|
import { get } from '../helpers/e2etest.js'
|
|
|
|
describe('GET /api/session', () => {
|
|
jest.setTimeout(60 * 1000)
|
|
// There's a "warmServer" in middleware/context.js
|
|
// that takes about 6-10 seconds to process first time
|
|
|
|
it('should render a non-cache include for CSRF token', async () => {
|
|
const res = await get('/api/session')
|
|
expect(res.status).toBe(200)
|
|
expect(JSON.parse(res.text).csrfToken).toBeTruthy()
|
|
expect(res.headers['cache-control']).toBe('private, no-store')
|
|
})
|
|
})
|