mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 15:49:01 +02:00
Add opt-out action to beta page
This commit is contained in:
@@ -34,6 +34,7 @@ describe 'BetaProgramHandler', ->
|
||||
describe "optIn", ->
|
||||
|
||||
beforeEach ->
|
||||
@user.betaProgram = false
|
||||
@call = (callback) =>
|
||||
@handler.optIn @user_id, callback
|
||||
|
||||
@@ -63,3 +64,37 @@ describe 'BetaProgramHandler', ->
|
||||
expect(err).to.not.equal null
|
||||
expect(err).to.be.instanceof Error
|
||||
done()
|
||||
|
||||
describe "optOut", ->
|
||||
|
||||
beforeEach ->
|
||||
@user.betaProgram = true
|
||||
@call = (callback) =>
|
||||
@handler.optOut @user_id, callback
|
||||
|
||||
it "should set betaProgram = true on user object", (done) ->
|
||||
@call (err) =>
|
||||
@user.betaProgram.should.equal false
|
||||
done()
|
||||
|
||||
it "should call user.save", (done) ->
|
||||
@call (err) =>
|
||||
@user.save.callCount.should.equal 1
|
||||
done()
|
||||
|
||||
it "should not produce an error", (done) ->
|
||||
@call (err) =>
|
||||
expect(err).to.equal null
|
||||
expect(err).to.not.be.instanceof Error
|
||||
done()
|
||||
|
||||
describe "when user.save produces an error", ->
|
||||
|
||||
beforeEach ->
|
||||
@user.save.callsArgWith(0, new Error('woops'))
|
||||
|
||||
it "should produce an error", (done) ->
|
||||
@call (err) =>
|
||||
expect(err).to.not.equal null
|
||||
expect(err).to.be.instanceof Error
|
||||
done()
|
||||
|
||||
Reference in New Issue
Block a user