From 444f01f879870d83745eec2249194c596f2ccb89 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Fri, 12 Apr 2019 08:34:06 -0300 Subject: [PATCH] Refactor test, component - Remove redundant code - change socialMediaUrl to add the attributes().href since that's the url - grab last element of url as username, makes an assumption, but a safer one --- webapp/pages/profile/_id/_slug.vue | 58 +++++++++---------- webapp/pages/settings/my-social-media.spec.js | 4 +- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 797645574..ae66c252d 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -202,39 +202,37 @@

- - - - + + - {{ $t('profile.socialMedia') }} {{ user.name | truncate(15) }}? - - - - + {{ $t('profile.socialMedia') }} {{ user.name | truncate(15) }}? + + + + + { it("displays a link to the currentUser's social media", () => { wrapper = Wrapper() - const socialMediaLink = wrapper.find('a') - expect(socialMediaLink.attributes().href).toBe(socialMediaUrl) + const socialMediaLink = wrapper.find('a').attributes().href + expect(socialMediaLink).toBe(socialMediaUrl) }) })