chore: remove tests

This commit is contained in:
Aaron Yarborough 2025-03-09 18:47:09 +00:00
parent 48c28b9c65
commit 2cc0956efb
9 changed files with 1 additions and 281 deletions

View file

@ -1,46 +0,0 @@
/* eslint-env jest */
import { render } from '@testing-library/react'
import Article from '../../src/components/Article/Article'
import '@testing-library/jest-dom'
import { formatDate } from '@/lib/helpers'
describe('Article', () => {
it('renders title', () => {
const props = generateArticleProps()
const { getByText } = render(<Article {...props} />)
const titleElement = getByText(props.attributes.title)
expect(titleElement).toBeInTheDocument()
})
it('renders description', () => {
const props = generateArticleProps()
const { getByText } = render(<Article {...props} />)
const descriptionElement = getByText(props.attributes.desc)
expect(descriptionElement).toBeInTheDocument()
})
it('renders pubdate if available', () => {
const props = generateArticleProps()
const { getByText } = render(<Article {...props} />)
const pubdateElement = getByText(formatDate(props.attributes.pubdate))
expect(pubdateElement).toBeInTheDocument()
})
it('renders content', () => {
const props = generateArticleProps()
const { container } = render(<Article {...props} />)
const contentElement = container.querySelector('[data-test=content]')
expect(contentElement.innerHTML).toBe(props.html)
})
})
function generateArticleProps () {
return {
attributes: {
title: 'My title',
desc: 'My description',
pubdate: new Date().toUTCString()
},
html: '<p>This is my content!</p>'
}
}

View file

@ -1,28 +0,0 @@
/* eslint-env jest */
import { render, screen } from '@testing-library/react'
import ExternalLink from '../../src/components/ExternalLink/ExternalLink'
import '@testing-library/jest-dom'
describe('ExternalLink', () => {
const props = {
href: 'https://example.com',
children: 'Test Link'
}
it('renders without crashing', () => {
render(<ExternalLink {...props} />)
})
it('renders correct href and rel attributes', () => {
render(<ExternalLink {...props} />)
const link = screen.getByText(props.children)
expect(link).toHaveAttribute('href', props.href)
expect(link).toHaveAttribute('rel', 'nofollow noopener')
expect(link).toHaveAttribute('target', '_blank')
})
it('renders children correctly', () => {
render(<ExternalLink {...props} />)
expect(screen.getByText(props.children)).toBeInTheDocument()
})
})

View file

@ -1,10 +0,0 @@
/* eslint-env jest */
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Footer from '@/components/Footer/Footer'
describe('Footer', () => {
it('renders without crashing', () => {
render(<Footer />)
})
})

View file

@ -1,16 +0,0 @@
/* eslint-env jest */
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Grid from '@/components/Grid/Grid'
describe('Grid', () => {
it('renders without crashing', () => {
const { container } = render(<Grid />)
expect(container.firstChild).toHaveClass('grid')
})
it('renders its children', () => {
const { getByText } = render(<Grid><div>Child</div></Grid>)
expect(getByText('Child')).toBeInTheDocument()
})
})

View file

@ -1,19 +0,0 @@
/* eslint-env jest */
import { render, screen } from '@testing-library/react'
import Header from '../../src/components/Header/Header'
import '@testing-library/jest-dom'
describe('Header', () => {
it('renders without crashing', () => {
render(
<Header />)
})
it('renders correct navigation links', () => {
render(<Header />)
const links = ['Home', 'Writing', 'CV']
links.forEach(link => {
expect(screen.getByText(link)).toBeInTheDocument()
})
})
})

View file

@ -1,63 +0,0 @@
/* eslint-env jest */
import { render } from '@testing-library/react'
import Resume from '../../src/components/Resume/Resume'
import '@testing-library/jest-dom'
describe('Resume', () => {
const props = {
competencies: ['Competency 1', 'Competency 2'],
education: 'My education history',
certifications: ['Certification 1', 'Certification 2'],
languages: [{ name: 'English', proficiency: 'Fluent' }],
experience: [
{
employer: 'Employer 1',
position: 'Position 1',
start: 'Start date 1',
end: 'End date 1',
desc: 'Description 1'
}
]
}
it('renders without crashing', () => {
render(<Resume {...props} />)
})
it('renders competencies', () => {
const { getByText } = render(<Resume {...props} />)
props.competencies.forEach(competency => {
expect(getByText(competency)).toBeInTheDocument()
})
})
it('renders education', () => {
const { getByText } = render(<Resume {...props} />)
expect(getByText(props.education)).toBeInTheDocument()
})
it('renders certifications', () => {
const { getByText } = render(<Resume {...props} />)
props.certifications.forEach(certification => {
expect(getByText(certification)).toBeInTheDocument()
})
})
it('renders languages', () => {
const { getByText } = render(<Resume {...props} />)
props.languages.forEach(language => {
expect(getByText(`${language.name} - ${language.proficiency}`)).toBeInTheDocument()
})
})
it('renders experience', () => {
const { getByText } = render(<Resume {...props} />)
props.experience.forEach(exp => {
expect(getByText(exp.employer)).toBeInTheDocument()
expect(getByText(exp.position)).toBeInTheDocument()
expect(getByText(exp.start)).toBeInTheDocument()
expect(getByText(exp.end)).toBeInTheDocument()
expect(getByText(exp.desc)).toBeInTheDocument()
})
})
})

View file

@ -1,29 +0,0 @@
/* eslint-env jest */
import { render, screen } from '@testing-library/react'
import DefaultLayout from '../../src/layouts/DefaultLayout/DefaultLayout'
import '@testing-library/jest-dom'
describe('DefaultLayout', () => {
const props = {
children: <div>Test Content</div>
}
it('renders without crashing', () => {
render(<DefaultLayout {...props} />)
})
it('renders Header', () => {
render(<DefaultLayout {...props} />)
expect(screen.getByTestId('header')).toBeInTheDocument()
})
it('renders Footer', () => {
render(<DefaultLayout {...props} />)
expect(screen.getByTestId('footer')).toBeInTheDocument()
})
it('renders children correctly', () => {
render(<DefaultLayout {...props} />)
expect(screen.getByText('Test Content')).toBeInTheDocument()
})
})

View file

@ -1,69 +0,0 @@
/* eslint-env jest */
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Writing, { Title, Description } from '../../src/pages/writing'
jest.mock('next/head', () => {
return {
__esModule: true,
default: ({ children }) => {
return <>{children}</>
}
}
})
describe('Writing', () => {
it('renders without crashing', () => {
render(
getStubWritingComponent())
})
it('renders meta title', async () => {
const { container } = render(getStubWritingComponent())
expect(container.querySelector('title')).toHaveTextContent(Title)
})
it('renders opengraph title', () => {
const { container } = render(getStubWritingComponent())
expect(container.querySelector('meta[property="og:title"]'))
.toHaveAttribute('content', Title)
})
it('renders meta description', () => {
const { container } = render(getStubWritingComponent())
expect(container.querySelector('meta[name="description"]'))
.toHaveAttribute('content', Description)
})
it('renders opengraph description', () => {
const { container } = render(getStubWritingComponent())
expect(container.querySelector('meta[property="og:description"]'))
.toHaveAttribute('content', Description)
})
})
function getStubWritingComponent () {
const entries = [
{
attributes: {
title: 'My title one',
pubdate: 'Mon, 18 Mar 2024 16:47:32 GMT',
desc: 'This is my description.'
},
html: '<p>This is some content</p>',
slug: 'my-title-one'
},
{
attributes: {
title: 'My title Two',
pubdate: 'Mon, 19 Mar 2024 16:47:32 GMT',
desc: 'This is my description.'
},
html: '<p>This is some content</p>',
slug: 'my-title-two'
}
]
return <Writing entries={entries} urlPrefix='/' />
}

View file

@ -14,7 +14,7 @@
"format": "npx standard --fix",
"prepare": "husky",
"deploy": "./util/pre-deploy.sh && ./util/deploy-gcloud.sh",
"test": "jest --verbose",
"test": "jest --verbose --passWithNoTests",
"lint": "next lint"
},
"dependencies": {