mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
7847209eaa
Fix referral projection GitOrigin-RevId: 37c68bf6bfa81a694e2f919b262634a9a1b63f8b
28 lines
901 B
JavaScript
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/)
|
|
})
|
|
})
|