mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fe963ba692
Replace request-promise with fetch in web acceptance tests GitOrigin-RevId: f50357cdea2d1353d7a82c5346b149018f91823f
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
const { expect } = require('chai')
|
|
const UserHelper = require('../src/helpers/UserHelper')
|
|
|
|
describe('BetaProgram', function () {
|
|
let email, userHelper
|
|
beforeEach(async function () {
|
|
userHelper = new UserHelper()
|
|
email = userHelper.getDefaultEmail()
|
|
userHelper = await UserHelper.createUser({ email })
|
|
userHelper = await UserHelper.loginUser({
|
|
email,
|
|
password: userHelper.getDefaultPassword(),
|
|
})
|
|
})
|
|
it('should opt in', async function () {
|
|
const response = await userHelper.fetch('/beta/opt-in', { method: 'POST' })
|
|
expect(response.status).to.equal(302)
|
|
expect(response.headers.get('location')).to.equal(
|
|
UserHelper.url('/beta/participate').toString()
|
|
)
|
|
const user = (await UserHelper.getUser({ email })).user
|
|
expect(user.betaProgram).to.equal(true)
|
|
})
|
|
it('should opt out', async function () {
|
|
const response = await userHelper.fetch('/beta/opt-out', { method: 'POST' })
|
|
expect(response.status).to.equal(302)
|
|
expect(response.headers.get('location')).to.equal(
|
|
UserHelper.url('/beta/participate').toString()
|
|
)
|
|
const user = (await UserHelper.getUser({ email })).user
|
|
expect(user.betaProgram).to.equal(false)
|
|
})
|
|
})
|