2019-05-29 05:21:06 -04:00
|
|
|
/* eslint-disable
|
2022-05-16 10:25:49 -04:00
|
|
|
n/handle-callback-err,
|
2019-05-29 05:21:06 -04:00
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2021-03-31 08:20:55 -04:00
|
|
|
const { expect } = require('chai')
|
2019-05-29 05:21:06 -04:00
|
|
|
const async = require('async')
|
|
|
|
const User = require('./helpers/User')
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('SettingsPage', function () {
|
|
|
|
beforeEach(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
this.user = new User()
|
|
|
|
return async.series(
|
|
|
|
[
|
|
|
|
this.user.ensureUserExists.bind(this.user),
|
|
|
|
this.user.login.bind(this.user),
|
|
|
|
],
|
|
|
|
done
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('load settings page', function (done) {
|
2019-08-07 10:04:04 -04:00
|
|
|
return this.user.getUserSettingsPage((err, statusCode) => {
|
2019-05-29 05:21:06 -04:00
|
|
|
statusCode.should.equal(200)
|
|
|
|
return done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('update main email address', function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
const newEmail = 'foo@bar.com'
|
|
|
|
return this.user.updateSettings({ email: newEmail }, error => {
|
2021-03-31 08:20:55 -04:00
|
|
|
expect(error).not.to.exist
|
2019-08-07 10:04:04 -04:00
|
|
|
return this.user.get((error, user) => {
|
2019-05-29 05:21:06 -04:00
|
|
|
user.email.should.equal(newEmail)
|
|
|
|
user.emails.length.should.equal(1)
|
|
|
|
user.emails[0].email.should.equal(newEmail)
|
|
|
|
return done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|