From 3934bf6a47efc0ffea0291eaae6bac41d4a6b91b Mon Sep 17 00:00:00 2001 From: Nimit Bhargava Date: Fri, 11 Dec 2020 17:12:50 +0530 Subject: [PATCH] testing: adding spec for social-media --- .../SocialMedia/SocialMedia.spec.js | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 webapp/components/SocialMedia/SocialMedia.spec.js diff --git a/webapp/components/SocialMedia/SocialMedia.spec.js b/webapp/components/SocialMedia/SocialMedia.spec.js new file mode 100644 index 000000000..b060b2738 --- /dev/null +++ b/webapp/components/SocialMedia/SocialMedia.spec.js @@ -0,0 +1,103 @@ +import { config, mount } from '@vue/test-utils' +import SocialMedia from './SocialMedia.vue' + +config.stubs['ds-space'] = '' +config.stubs['ds-text'] = '' + +describe('SocialMedia.vue', () => { + let propsData + let mocks + + beforeEach(() => { + propsData = {} + + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(SocialMedia, { propsData, mocks }) + } + + // it('has class "hc-badges"', () => { + // expect(Wrapper().contains('.hc-badges')).toBe(true) + // }) + + describe('new test', () => { + beforeEach(() => { + propsData.userName = 'Jenny Rostock' + propsData.user = { + socialMedia: [ + { + id: 'ee1e8ed6-fbef-4bcf-b411-a12926f2ea1e', + url: 'https://www.instagram.com/nimitbhargava', + __typename: 'SocialMedia', + }, + ], + } + }) + + it('renders socialMedia card title', () => { + Wrapper() + expect(mocks.$t).toHaveBeenCalledWith('profile.socialMedia') + }) + }) + + describe('given a badge', () => { + beforeEach(() => { + propsData.userName = 'Jenny Rostock' + propsData.user = { + socialMedia: [ + { + id: 'ee1e8ed6-fbef-4bcf-b411-a12926f2ea1e', + url: 'https://www.instagram.com/nimitbhargava', + __typename: 'SocialMedia', + }, + { + id: 'dc91aecb-3289-47d0-8770-4b24eb24fd9c', + url: 'https://www.facebook.com/NimitBhargava', + __typename: 'SocialMedia', + }, + { + id: 'db1dc400-9303-4b43-9451-87dcac13b913', + url: 'https://www.youtube.com/channel/UCu3GiKBFn5I07V9hBxF2CRA', + __typename: 'SocialMedia', + }, + { + id: '3423d494-13e9-4be3-84c1-c4b5fdaa4077', + url: 'https://twitter.com/NimitBhargava', + __typename: 'SocialMedia', + }, + { + id: 'a29421ed-0e97-455c-9932-b294ca39f0b2', + url: 'https://www.linkedin.com/in/nimitbhargava', + __typename: 'SocialMedia', + }, + { + id: 'c5079a2c-8127-4620-8a34-7e1bccfa13b7', + url: 'https://freeradical.zone/@mattwr18', + __typename: 'SocialMedia', + }, + { + id: 'cf2e00cd-e060-4216-b8ee-8b6a917ec6d0', + url: 'https://twitter.com/mattwr18', + __typename: 'SocialMedia', + }, + ], + } + }) + + // Case 0: + // Display profile links + // + // Case1: + // Have 3 links + // Expected 3 links + // + // Case 2: + // Simulate click on link - expect click on link + }) + }) +})