Match user by id instead of email, update feature

This commit is contained in:
Matt Rider 2019-04-02 18:05:45 -03:00
parent 94288ced54
commit 80f664dd78
3 changed files with 16 additions and 7 deletions

View File

@ -104,14 +104,14 @@ export default {
addSocialMedia: async (_, { url }, { driver, user }) => {
const session = driver.session()
const { email } = user
const { id } = user
const result = await session.run(
`MATCH (user:User {email: $userEmail})
`MATCH (user:User {id: $userId})
SET user.socialMedia = user.socialMedia + $url
RETURN user {.socialMedia}
`,
{
userEmail: email,
userId: id,
url
}
)
@ -119,6 +119,7 @@ export default {
const [currentUser] = result.records.map(record => {
return record.get('user')
})
console.log(currentUser)
return currentUser.socialMedia
}
}

View File

@ -11,4 +11,6 @@ Feature: List Social Media Accounts
Scenario: Adding Social Media
Given I click on the "My social media" link
Then I should be on the "/settings/my-social-media" page
And I should be able to add a social media link
When I add a social media link
Then it gets saved successfully
And the new social media link shows up on the page

View File

@ -77,14 +77,20 @@ Then('I should be on the {string} page', page => {
.should('contain', 'My social media')
})
Then('I should be able to add a social media link', () => {
Then('I add a social media link', () => {
cy.get("input[name='social-media']")
.type('https://freeradical.zone/@mattwr18')
.get('button')
.contains('Add social media')
.click()
.get('.iziToast-message')
})
Then('it gets saved successfully', () => {
cy.get('.iziToast-message')
.should('contain', 'Updated user')
.get('a')
})
Then('the new social media link shows up on the page', () => {
cy.get('a')
.contains("src='https://freeradical.zone/@mattwr18'")
})