-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from oslabs-beta/testing
added unit tests for www directory
- Loading branch information
Showing
13 changed files
with
398 additions
and
1,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import Blogs from '../src/pages/components/Blogs'; | ||
import React from 'react'; | ||
|
||
const posts = [ | ||
{ | ||
title: 'Our Legendary Article here', | ||
href: '#', | ||
category: { name: 'Greatness', href: '#' }, | ||
description: | ||
'Reactime v17, we have come a long way from beta. Now introducing full Context API support and CustomHooks support: thereby allowing developers to better visualize the states and ... ', | ||
date: 'Dec 14, 2022', | ||
datetime: '2022-12-14', | ||
imageUrl: | ||
'https://images.unsplash.com/photo-1496128858413-b36217c2ce36?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1679&q=80', | ||
readingTime: '6 min', | ||
author: { | ||
name: 'James Nghiem', | ||
href: '#', | ||
imageUrl: | ||
'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', | ||
}, | ||
}, | ||
{ | ||
title: 'Time-Traveling Through React State', | ||
href: 'https://rxlina.medium.com/time-traveling-through-react-state-with-reactime-9-0-371dbdc99319', | ||
category: { name: 'React', href: 'https://medium.com/tag/react' }, | ||
description: | ||
'Reactime is a Chrome extension and time-travel debugger for React that allows developers to record, track, and visualize state changes. Reactime leverages React’s core reconciliation... ', | ||
date: 'Oct 7, 2021', | ||
datetime: '2020-10-07', | ||
imageUrl: | ||
'https://images.unsplash.com/photo-1547586696-ea22b4d4235d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1679&q=80', | ||
readingTime: '4 min', | ||
author: { | ||
name: 'Lina Shin', | ||
href: 'https://rxlina.medium.com/', | ||
imageUrl: | ||
'https://media-exp1.licdn.com/dms/image/C5603AQHQGFvRHt25WQ/profile-displayphoto-shrink_200_200/0/1623865299399?e=1676505600&v=beta&t=yDqgIaJOhO3oOWLROIH9rHPBHdVzDSV3VlB2axWqXr4', | ||
}, | ||
}, | ||
{ | ||
title: 'What time is it? Reactime!', | ||
href: 'https://medium.com/@robbytiptontol/inter-route-time-travel-with-reactime-d84cd55ec73b', | ||
category: { name: 'React Devtools', href: 'https://medium.com/tag/react-devtools' }, | ||
description: 'Reactime is a debugging tool that lets developers take snapshots of an application\’s state data as well as time-travel through these snapshots. The snapshots display React...', | ||
date: 'Jun 16, 2022', | ||
datetime: '2022-06-16', | ||
imageUrl: | ||
'https://images.unsplash.com/photo-1492724441997-5dc865305da7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1679&q=80', | ||
readingTime: '9 min', | ||
author: { | ||
name: 'Robby Tipton', | ||
href: 'https://medium.com/@robbytiptontol', | ||
imageUrl: | ||
'https://miro.medium.com/fit/c/96/96/1*pi-RH2LRvsZA9vLZTvY2mg.jpeg', | ||
}, | ||
}, | ||
] | ||
|
||
describe('Blog component test ', () => { | ||
beforeEach(() => { | ||
render (<Blogs />) | ||
}) | ||
|
||
it ('the title appears on the page', () => { | ||
expect(screen.getByText(/From the Blog/i)).toBeInTheDocument() | ||
expect(screen.getByText(/See the blogs from the most recent updates and to the past years!/i)).toBeInTheDocument() | ||
}); | ||
|
||
it ('displays the correct information for each blog post', () => { | ||
const blogs = screen.getAllByTestId('blog') | ||
blogs.forEach((blog) => { | ||
|
||
|
||
}) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {screen, render} from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import FeaturesSection from '../src/pages/components/FeaturesSection'; | ||
|
||
const features = [ | ||
{ | ||
name: 'State SnapShot Display', | ||
description: 'See your application state in a stylized and interactive format, for clear concise state management', | ||
}, | ||
{ | ||
name: 'Time Travel Rendering', | ||
description: 'Simulate any state change from your DOM history, with a simple click of a button', | ||
}, | ||
{ | ||
name: 'Action Comparison & Snapshot Series', | ||
description: 'Save a series of state snapshots and use it to analyze changes in component render performance between current and previous series of snapshots.', | ||
}, | ||
] | ||
|
||
describe('FeatureSection component test ', () => { | ||
beforeEach(() => { | ||
render(<FeaturesSection />) | ||
}); | ||
|
||
it('Renders the core features section', () => { | ||
expect(screen.getByText(/Core Features/i)).toBeInTheDocument(); | ||
}); | ||
|
||
it('Title appears on the page', () => { | ||
expect(screen.getByText(/What makes Reactime so great\?/i)).toBeInTheDocument(); | ||
}); | ||
|
||
it('Subheading shows up on the page', () => { | ||
expect(screen.getByText(/Reactime is full of features that make your life easier as a developer. From time-travel debugging to state snapshot display, check out how using Reactime will improve your developer experience./i)).toBeInTheDocument(); | ||
}) | ||
|
||
it('Renders all feature name and descriptions', () => { | ||
features.forEach((feature) => { | ||
expect(screen.getByText(feature.name)).toBeInTheDocument(); | ||
expect(screen.getByText(feature.description)).toBeInTheDocument(); | ||
}); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest` | ||
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest` | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tsconfig.jest.json', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "react-jsx" | ||
} | ||
} |
Oops, something went wrong.