From 456173f6779749ed3db4458293e75db33fd6b635 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Mon, 10 Aug 2020 13:28:17 +0200 Subject: [PATCH] fix: use Login over custom button --- client/src/components/Intro/Intro.test.js | 13 ++++++++++--- client/src/components/Intro/index.js | 14 ++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/client/src/components/Intro/Intro.test.js b/client/src/components/Intro/Intro.test.js index 1a5c9636de..2961eeeb0a 100644 --- a/client/src/components/Intro/Intro.test.js +++ b/client/src/components/Intro/Intro.test.js @@ -1,21 +1,28 @@ /* global expect */ import React from 'react'; import renderer from 'react-test-renderer'; -// import ShallowRenderer from 'react-test-renderer/shallow'; +import { Provider } from 'react-redux'; +import { createStore } from '../../redux/createStore'; import 'jest-dom/extend-expect'; import Intro from './'; +function rendererCreateWithRedux(ui) { + return renderer.create({ui}); +} + describe('', () => { it('has no blockquotes when loggedOut', () => { - const container = renderer.create().root; + const container = rendererCreateWithRedux() + .root; expect(container.findAllByType('blockquote').length === 0).toBeTruthy(); expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); it('has a blockquote when loggedIn', () => { - const container = renderer.create().root; + const container = rendererCreateWithRedux() + .root; expect(container.findAllByType('blockquote').length === 1).toBeTruthy(); expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); diff --git a/client/src/components/Intro/index.js b/client/src/components/Intro/index.js index d559c5f2d5..9b5cf80c3f 100644 --- a/client/src/components/Intro/index.js +++ b/client/src/components/Intro/index.js @@ -2,18 +2,18 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Link, Spacer, Loader, FullWidthRow } from '../helpers'; import { Row, Col } from '@freecodecamp/react-bootstrap'; -import { apiLocation, forumLocation } from '../../../config/env.json'; +import { forumLocation } from '../../../config/env.json'; import { randomQuote } from '../../utils/get-words'; import CurrentChallengeLink from '../helpers/CurrentChallengeLink'; import './intro.css'; +import Login from '../Header/components/Login'; const propTypes = { complete: PropTypes.bool, completedChallengeCount: PropTypes.number, isSignedIn: PropTypes.bool, name: PropTypes.string, - navigate: PropTypes.func, pending: PropTypes.bool, slug: PropTypes.string, username: PropTypes.string @@ -23,7 +23,6 @@ function Intro({ isSignedIn, username, name, - navigate, pending, complete, completedChallengeCount, @@ -163,14 +162,9 @@ function Intro({ - +