From e89aff1272c7df9d6e31a13a54f03cbcd0bc16cc Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Wed, 18 Sep 2019 13:09:33 +0200 Subject: [PATCH] Fix bug where about must not be empty string - add test case to test this use case since it is the default from our UI --- backend/src/models/User.js | 2 +- backend/src/schema/resolvers/registration.spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/src/models/User.js b/backend/src/models/User.js index 465abfb65..72cef4093 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -16,7 +16,7 @@ module.exports = { wasInvited: 'boolean', wasSeeded: 'boolean', locationName: { type: 'string', allow: [null] }, - about: { type: 'string', allow: [null] }, + about: { type: 'string', allow: [null, ''] }, primaryEmail: { type: 'relationship', relationship: 'PRIMARY_EMAIL', diff --git a/backend/src/schema/resolvers/registration.spec.js b/backend/src/schema/resolvers/registration.spec.js index 531eabea1..81326004d 100644 --- a/backend/src/schema/resolvers/registration.spec.js +++ b/backend/src/schema/resolvers/registration.spec.js @@ -484,6 +484,17 @@ describe('SignupVerification', () => { }) }) + it('allowing the about field to be an empty string', async () => { + variables = { ...variables, about: '' } + await expect(mutate({ mutation, variables })).resolves.toMatchObject({ + data: { + SignupVerification: expect.objectContaining({ + id: expect.any(String), + }), + }, + }) + }) + it('marks the EmailAddress as primary', async () => { const cypher = ` MATCH(email:EmailAddress)<-[:PRIMARY_EMAIL]-(u:User {name: {name}})