1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/tests/rendering/csrf-route.js
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

17 lines
620 B
JavaScript

const request = require('supertest')
const app = require('../../server')
describe('GET /csrf', () => {
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 request(app).get('/csrf')
expect(res.status).toBe(200)
expect(res.text).toMatch(/^<meta name="csrf-token" content="(.*?)" \/>$/)
expect(res.headers['surrogate-control']).toBe('private, no-store')
expect(res.headers['cache-control']).toBe('private, no-store')
})
})