overleaf/services/web/test/acceptance/src/BonusTests.js
Jakob Ackermann 7847209eaa Merge pull request #3049 from overleaf/jlm-fix-referral-projection
Fix referral projection

GitOrigin-RevId: 37c68bf6bfa81a694e2f919b262634a9a1b63f8b
2020-07-28 02:06:20 +00:00

28 lines
901 B
JavaScript

const { expect } = require('chai')
const cheerio = require('cheerio')
const UserHelper = require('../src/helpers/UserHelper')
describe('Bonus', function() {
let userHelper
beforeEach(async function() {
userHelper = new UserHelper()
const email = userHelper.getDefaultEmail()
userHelper = await UserHelper.createUser({ email })
userHelper = await UserHelper.loginUser({
email,
password: userHelper.getDefaultPassword()
})
})
it('should use the count rather than refered_users', async function() {
await UserHelper.updateUser(userHelper.user._id, {
$set: { refered_user_count: 1, refered_users: [] }
})
const response = await userHelper.request.get('/user/bonus')
expect(response.statusCode).to.equal(200)
const dom = cheerio.load(response.body)
expect(dom('.bonus-status').text()).to.match(/You've introduced 1 person/)
})
})