diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d33c83e..90d42cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: uses: actions/cache@v1 with: path: public - key: ${{ runner.os }}-public + key: ${{ runner.os }}-${{ matrix.node-version }}-public - run: npm ci - run: npm test diff --git a/src/components/Layout.jsx b/src/components/Layout.jsx index ecd46b3..ff3cfa9 100644 --- a/src/components/Layout.jsx +++ b/src/components/Layout.jsx @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import posed, { PoseGroup } from 'react-pose' +import shortid from 'shortid' import { fadeIn } from './atoms/Transitions' import Typekit from './atoms/Typekit' import HostnameCheck from './atoms/HostnameCheck' @@ -36,9 +37,9 @@ export default function Layout({ children, location }) { - + diff --git a/src/components/Layout.test.jsx b/src/components/Layout.test.jsx new file mode 100644 index 0000000..a7d6e3c --- /dev/null +++ b/src/components/Layout.test.jsx @@ -0,0 +1,15 @@ +import React from 'react' +import { render } from '@testing-library/react' +import { createHistory, createMemorySource } from '@reach/router' +import Layout from './Layout' + +describe('Layout', () => { + const history = createHistory(createMemorySource('/oceanprotocol')) + + it('renders correctly', () => { + const { container } = render( + Hello + ) + expect(container.firstChild).toBeInTheDocument() + }) +}) diff --git a/src/components/atoms/Button.test.jsx b/src/components/atoms/Button.test.jsx deleted file mode 100644 index 749b506..0000000 --- a/src/components/atoms/Button.test.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react' - -import Button from './Button' - -describe('Button', () => { - it('renders correctly', () => { - const { container } = render() - - expect(container.firstChild.nodeName).toBe('A') - expect(container.firstChild).toBeInTheDocument() - }) - - it('renders children', () => { - const children = Hello World - const { container } = render() - - expect(container.firstChild.nodeName).toBe('A') - expect(container.firstChild).toBeInTheDocument() - }) -}) diff --git a/src/components/atoms/ProjectImage.test.jsx b/src/components/atoms/ProjectImage.test.jsx deleted file mode 100644 index b3d434b..0000000 --- a/src/components/atoms/ProjectImage.test.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react' -import ProjectImage from './ProjectImage' -import data from '../../../jest/__fixtures__/projects.json' - -describe('ProjectImage', () => { - it('renders correctly', () => { - const { node } = data.allProjectsYaml.edges[0] - const { fluid } = node.img.childImageSharp - - const { container } = render( - - ) - - expect(container.firstChild).toBeInTheDocument() - }) -}) diff --git a/src/components/atoms/Typekit.jsx b/src/components/atoms/Typekit.jsx index 0eb46b7..68a1c27 100644 --- a/src/components/atoms/Typekit.jsx +++ b/src/components/atoms/Typekit.jsx @@ -20,7 +20,7 @@ const TypekitScript = typekitID => ( const Typekit = () => { const { typekitID } = useMeta() - return typekitID ? ( + return ( @@ -28,7 +28,7 @@ const Typekit = () => { {TypekitScript(typekitID)} - ) : null + ) } export default Typekit diff --git a/src/components/molecules/ProjectLinks.test.jsx b/src/components/molecules/ProjectLinks.test.jsx deleted file mode 100644 index 24462be..0000000 --- a/src/components/molecules/ProjectLinks.test.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react' -import ProjectLinks from './ProjectLinks' - -describe('ProjectLinks', () => { - const links = [ - { - title: 'my project', - icon: 'website', - url: 'https://hello.com' - }, - { - title: 'GitHub', - url: 'https://github.com' - } - ] - - it('renders correctly', () => { - const { container, getAllByTestId } = render() - - expect(container.firstChild).toBeInTheDocument() - expect(getAllByTestId('link')[0].nodeName).toBe('A') - expect(getAllByTestId('link')[0].textContent).toBe('my project') - expect(getAllByTestId('link')[0].attributes.href.textContent).toBe( - 'https://hello.com' - ) - }) -}) diff --git a/src/components/molecules/ProjectTechstack.test.jsx b/src/components/molecules/ProjectTechstack.test.jsx deleted file mode 100644 index 148690b..0000000 --- a/src/components/molecules/ProjectTechstack.test.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react' -import ProjectTechstack from './ProjectTechstack' - -describe('ProjectTechstack', () => { - const techstack = ['CSS'] - - it('renders correctly', () => { - const { container } = render() - - expect(container.firstChild).toBeInTheDocument() - expect(container.querySelector('li').textContent).toBe('CSS') - }) -}) diff --git a/src/components/organisms/Footer.test.jsx b/src/components/organisms/Footer.test.jsx deleted file mode 100644 index 8a6213d..0000000 --- a/src/components/organisms/Footer.test.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react' -import Footer from './Footer' - -describe('Footer', () => { - it('renders correctly', () => { - const { container } = render(