Return the Promise from an expressified async function (#19359)

* Return the Promise from an expressified async function

GitOrigin-RevId: ca4c221a92de888e210e995faad97d0ea241e93f
This commit is contained in:
Alf Eaton
2024-07-15 09:05:29 +00:00
committed by Copybot
parent bcef7ea125
commit 136214f37a
3 changed files with 37 additions and 71 deletions
@@ -42,13 +42,12 @@ describe('TemplatesController', function () {
describe('createProjectFromV1Template', function () {
describe('on success', function () {
beforeEach(function (done) {
beforeEach(function () {
this.project = { _id: 'project-id' }
this.TemplatesManager.promises.createProjectFromV1Template.resolves(
this.project
)
this.res.redirect.callsFake(() => done())
this.TemplatesController.createProjectFromV1Template(
return this.TemplatesController.createProjectFromV1Template(
this.req,
this.res,
this.next
@@ -79,11 +78,10 @@ describe('TemplatesController', function () {
})
describe('on error', function () {
beforeEach(function (done) {
beforeEach(function () {
this.TemplatesManager.promises.createProjectFromV1Template.rejects(
'error'
)
this.next.callsFake(() => done())
return this.TemplatesController.createProjectFromV1Template(
this.req,
this.res,