diff --git a/backend/src/resolvers/user_management.js b/backend/src/resolvers/user_management.js index 814aee3fb..fc8ca36b3 100644 --- a/backend/src/resolvers/user_management.js +++ b/backend/src/resolvers/user_management.js @@ -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 } } diff --git a/cypress/integration/SocialMedia.feature b/cypress/integration/SocialMedia.feature index 05ecfc882..91ee9919c 100644 --- a/cypress/integration/SocialMedia.feature +++ b/cypress/integration/SocialMedia.feature @@ -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 \ No newline at end of file diff --git a/cypress/integration/common/settings.js b/cypress/integration/common/settings.js index c87d15aec..d31baefce 100644 --- a/cypress/integration/common/settings.js +++ b/cypress/integration/common/settings.js @@ -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'") })