Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [develop] release 4.35.1 hotfix #334

Merged
merged 6 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ script:
- npm run lint-ci
- npm run build
- npm run test-ci
- npm run test-e2e-ci
# - npm run test-e2e-ci

before_deploy:
# Workaround to run before_deploy only once
Expand Down
351 changes: 177 additions & 174 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "4.35.0",
"version": "4.35.1",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand Down
18 changes: 9 additions & 9 deletions src/app/modules/auth/__tests__/auth.routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('"email" is required')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.email is invalid', async () => {
Expand All @@ -46,7 +46,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('Please enter a valid email')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 401 when domain of body.email does not exist in Agency collection', async () => {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('"email" is required')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.email is invalid', async () => {
Expand All @@ -136,7 +136,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('Please enter a valid email')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 401 when domain of body.email does not exist in Agency collection', async () => {
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('"email" is required')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.otp is not provided as a param', async () => {
Expand All @@ -265,7 +265,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('"otp" is required')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.email is invalid', async () => {
Expand All @@ -279,7 +279,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('Please enter a valid email')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.otp is less than 6 digits', async () => {
Expand All @@ -291,7 +291,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('Please enter a valid otp')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 400 when body.otp is 6 characters but does not consist purely of digits', async () => {
Expand All @@ -303,7 +303,7 @@ describe('auth.routes', () => {

// Assert
expect(response.status).toEqual(400)
expect(response.text).toEqual('Please enter a valid otp')
expect(response.text).toEqual('Some required parameters are missing')
})

it('should return 401 when domain of body.email does not exist in Agency collection', async () => {
Expand Down
9 changes: 3 additions & 6 deletions src/loaders/express/error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ const errorHandlerMiddlewares = () => {
'Apologies, something odd happened. Please try again later!'
// Error page
if (isCelebrate(err)) {
const errorMessage = get(
err,
'joi.details[0].message',
genericErrorMessage,
)
// formId is only present for Joi validated routes that require it
const formId = get(req, 'form._id', null)
logger.error({
Expand All @@ -43,7 +38,9 @@ const errorHandlerMiddlewares = () => {
},
error: err,
})
return res.status(StatusCodes.BAD_REQUEST).send(errorMessage)
return res
.status(StatusCodes.BAD_REQUEST)
.send('Some required parameters are missing')
}

logger.error({
Expand Down