Check that about actually gets saved

This commit is contained in:
roschaefer 2019-09-07 01:17:19 +02:00
parent 0cd7ac3d32
commit b656b5aeb9
4 changed files with 41 additions and 26 deletions

View File

@ -327,6 +327,7 @@ describe('SignupVerification', () => {
$password: String!
$email: String!
$nonce: String!
$about: String
$termsAndConditionsAgreedVersion: String!
) {
SignupVerification(
@ -334,6 +335,7 @@ describe('SignupVerification', () => {
password: $password
email: $email
nonce: $nonce
about: $about
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
) {
id
@ -423,6 +425,15 @@ describe('SignupVerification', () => {
expect(emails).toHaveLength(1)
})
it('set `about` attribute of User', async () => {
variables = { ...variables, about: 'Find this description in the user profile' }
await mutate({ mutation, variables })
const user = await neode.first('User', { name: 'John Doe' })
await expect(user.toJson()).resolves.toMatchObject({
about: 'Find this description in the user profile',
})
})
it('marks the EmailAddress as primary', async () => {
const cypher = `
MATCH(email:EmailAddress)<-[:PRIMARY_EMAIL]-(u:User {name: {name}})

View File

@ -1,5 +1,6 @@
import { config, mount, createLocalVue } from '@vue/test-utils'
import CreateUserAccount, { SignupVerificationMutation } from './CreateUserAccount'
import CreateUserAccount from './CreateUserAccount'
import { SignupVerificationMutation } from '~/graphql/Registration.js'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
@ -55,6 +56,7 @@ describe('CreateUserAccount', () => {
wrapper = Wrapper()
wrapper.find('input#name').setValue('John Doe')
wrapper.find('input#password').setValue('hellopassword')
wrapper.find('textarea#about').setValue('Hello I am the `about` attribute')
wrapper.find('input#passwordConfirmation').setValue('hellopassword')
wrapper.find('input#checkbox').setChecked()
await wrapper.find('form').trigger('submit')
@ -72,7 +74,7 @@ describe('CreateUserAccount', () => {
await action()
const expected = expect.objectContaining({
variables: {
about: '',
about: 'Hello I am the `about` attribute',
name: 'John Doe',
email: 'sixseven@example.org',
nonce: '666777',

View File

@ -25,7 +25,7 @@
:placeholder="$t('settings.data.namePlaceholder')"
/>
<ds-input
id="bio"
id="about"
model="about"
type="textarea"
rows="3"
@ -83,34 +83,12 @@
</template>
<script>
import gql from 'graphql-tag'
import PasswordStrength from '../Password/Strength'
import { SweetalertIcon } from 'vue-sweetalert-icons'
import PasswordForm from '~/components/utils/PasswordFormHelper'
import { VERSION } from '~/constants/terms-and-conditions-version.js'
import { SignupVerificationMutation } from '~/graphql/Registration.js'
/* TODO: hier muss die version rein */
export const SignupVerificationMutation = gql`
mutation(
$nonce: String!
$name: String!
$email: String!
$password: String!
$termsAndConditionsAgreedVersion: String!
) {
SignupVerification(
nonce: $nonce
email: $email
name: $name
password: $password
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
) {
id
name
slug
}
}
`
export default {
components: {
PasswordStrength,

View File

@ -0,0 +1,24 @@
import gql from 'graphql-tag'
export const SignupVerificationMutation = gql`
mutation(
$nonce: String!
$name: String!
$email: String!
$password: String!
$about: String
$termsAndConditionsAgreedVersion: String!
) {
SignupVerification(
nonce: $nonce
email: $email
name: $name
password: $password
about: $about
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
) {
id
name
slug
}
}
`