Remove resolve when passed as next

GitOrigin-RevId: 071ce6a4cab210f2db0d278aeb08d31fbba4cbfc
This commit is contained in:
Andrew Rumble
2025-06-13 09:06:16 +01:00
committed by Copybot
parent e76a8ff267
commit d3d5674436
3 changed files with 103 additions and 103 deletions

View File

@@ -79,14 +79,14 @@ describe('BetaProgramController', function () {
})
describe('optIn', function () {
it("should redirect to '/beta/participate'", async function(ctx) {
it("should redirect to '/beta/participate'", async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
ctx.res.redirectedTo.should.equal('/beta/participate')
resolve()
}
ctx.BetaProgramController.optIn(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optIn(ctx.req, ctx.res)
})
})
it('should not call next with an error', function (ctx) {
@@ -99,7 +99,7 @@ describe('BetaProgramController', function () {
ctx.BetaProgramHandler.promises.optIn.callCount.should.equal(1)
})
it('should invoke the session maintenance', async function(ctx) {
it('should invoke the session maintenance', async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
ctx.SplitTestSessionHandler.promises.sessionMaintenance.should.have.been.calledWith(
@@ -107,8 +107,8 @@ describe('BetaProgramController', function () {
)
resolve()
}
ctx.BetaProgramController.optIn(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optIn(ctx.req, ctx.res)
})
})
describe('when BetaProgramHandler.opIn produces an error', function () {
@@ -121,49 +121,49 @@ describe('BetaProgramController', function () {
ctx.res.redirect.callCount.should.equal(0)
})
it('should produce an error', async function(ctx) {
it('should produce an error', async function (ctx) {
await new Promise(resolve => {
ctx.BetaProgramController.optIn(ctx.req, ctx.res, err => {
expect(err).to.be.instanceof(Error)
resolve()
})
});
})
})
})
})
describe('optOut', function () {
it("should redirect to '/beta/participate'", async function(ctx) {
it("should redirect to '/beta/participate'", async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
expect(ctx.res.redirectedTo).to.equal('/beta/participate')
resolve()
}
ctx.BetaProgramController.optOut(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optOut(ctx.req, ctx.res)
})
})
it('should not call next with an error', async function(ctx) {
it('should not call next with an error', async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
ctx.next.callCount.should.equal(0)
resolve()
}
ctx.BetaProgramController.optOut(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optOut(ctx.req, ctx.res)
})
})
it('should call BetaProgramHandler.optOut', async function(ctx) {
it('should call BetaProgramHandler.optOut', async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
ctx.BetaProgramHandler.promises.optOut.callCount.should.equal(1)
resolve()
}
ctx.BetaProgramController.optOut(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optOut(ctx.req, ctx.res)
})
})
it('should invoke the session maintenance', async function(ctx) {
it('should invoke the session maintenance', async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
ctx.SplitTestSessionHandler.promises.sessionMaintenance.should.have.been.calledWith(
@@ -172,8 +172,8 @@ describe('BetaProgramController', function () {
)
resolve()
}
ctx.BetaProgramController.optOut(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optOut(ctx.req, ctx.res)
})
})
describe('when BetaProgramHandler.optOut produces an error', function () {
@@ -181,23 +181,23 @@ describe('BetaProgramController', function () {
ctx.BetaProgramHandler.promises.optOut.throws(new Error('woops'))
})
it("should not redirect to '/beta/participate'", async function(ctx) {
it("should not redirect to '/beta/participate'", async function (ctx) {
await new Promise(resolve => {
ctx.BetaProgramController.optOut(ctx.req, ctx.res, error => {
expect(error).to.exist
expect(ctx.res.redirected).to.equal(false)
resolve()
})
});
})
})
it('should produce an error', async function(ctx) {
it('should produce an error', async function (ctx) {
await new Promise(resolve => {
ctx.BetaProgramController.optOut(ctx.req, ctx.res, error => {
expect(error).to.exist
resolve()
})
});
})
})
})
})
@@ -207,14 +207,14 @@ describe('BetaProgramController', function () {
ctx.UserGetter.promises.getUser.resolves(ctx.user)
})
it('should render the opt-in page', async function(ctx) {
it('should render the opt-in page', async function (ctx) {
await new Promise(resolve => {
ctx.res.callback = () => {
expect(ctx.res.renderedTemplate).to.equal('beta_program/opt_in')
resolve()
}
ctx.BetaProgramController.optInPage(ctx.req, ctx.res, resolve)
});
ctx.BetaProgramController.optInPage(ctx.req, ctx.res)
})
})
describe('when UserGetter.getUser produces an error', function () {
@@ -227,14 +227,14 @@ describe('BetaProgramController', function () {
ctx.res.render.callCount.should.equal(0)
})
it('should produce an error', async function(ctx) {
it('should produce an error', async function (ctx) {
await new Promise(resolve => {
ctx.BetaProgramController.optInPage(ctx.req, ctx.res, error => {
expect(error).to.exist
expect(error).to.be.instanceof(Error)
resolve()
})
});
})
})
})
})