expectErrorResponse.mjs 592 B

12345678910111213141516171819202122
  1. import { expect } from 'chai'
  2. export default {
  3. requireLogin: {
  4. json(response, body) {
  5. expect(response.statusCode).to.equal(401)
  6. expect(body).to.equal('Unauthorized')
  7. expect(response.headers['www-authenticate']).to.equal('OverleafLogin')
  8. },
  9. },
  10. restricted: {
  11. html(response, body) {
  12. expect(response.statusCode).to.equal(403)
  13. expect(body).to.match(/<head><title translate="no">Restricted/)
  14. },
  15. json(response, body) {
  16. expect(response.statusCode).to.equal(403)
  17. expect(body).to.deep.equal({ message: 'restricted' })
  18. },
  19. },
  20. }