Skip to content

Commit

Permalink
commit failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Apr 28, 2021
1 parent f0b4230 commit a5b070e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": []
}
14 changes: 14 additions & 0 deletions components/some-comp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dynamic from 'next/dynamic'

const SomeDynamicComp = dynamic(() =>
import('./some-dynamic-comp').then((mod) => mod.SomeDynamicComp),
{ ssr: false })

export function SomeComp () {
return (
<div>
Hello world
<SomeDynamicComp />
</div>
)
}
8 changes: 8 additions & 0 deletions components/some-comp.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import { render } from '@testing-library/react'

import { SomeComp } from './some-comp'

it('renders without error', () => {
render(<SomeComp />)
})
7 changes: 7 additions & 0 deletions components/some-dynamic-comp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function SomeDynamicComp () {
return (
<div>
Hello dynamic world
</div>
)
}
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
clearMocks: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8'
}
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
future: {
webpack5: true
}
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
"start": "next start",
"test": "jest --coverage"
},
"dependencies": {
"next": "10.2.0",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"jest": "^26.5.3",
"@testing-library/react": "^11.0.4"
}
}
4 changes: 3 additions & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'

import { SomeComp } from '../components/some-comp'

export default function Home() {
return (
<div className={styles.container}>
Expand All @@ -10,7 +12,7 @@ export default function Home() {
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>

<SomeComp />
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
Expand Down

0 comments on commit a5b070e

Please sign in to comment.