-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb345a8
commit 9fb135e
Showing
7 changed files
with
6,684 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
06-test-react-components-with-jest-and-react-testing-library/.babelrc.js
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,13 @@ | ||
const isTest = String(process.env.NODE_ENV) === 'test'; | ||
const isProd = String(process.env.NODE_ENV) === 'production'; | ||
|
||
module.exports = { | ||
presets: [ | ||
['@babel/preset-env', {modules: isTest ? 'commonjs' : false}], | ||
'@babel/preset-react', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-proposal-object-rest-spread', | ||
].filter(Boolean), | ||
}; |
3 changes: 3 additions & 0 deletions
3
06-test-react-components-with-jest-and-react-testing-library/README.md
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,3 @@ | ||
# Test React Components with Jest and `react-testing-library` | ||
|
||
Checkout individual branches for changes specific to that section of the course. |
12 changes: 12 additions & 0 deletions
12
...st-react-components-with-jest-and-react-testing-library/__tests__/favorite-number.test.js
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,12 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import {FavoriteNumber} from '../src/favorite-number'; | ||
|
||
describe('FavoriteNumber', () => { | ||
test('renders a number input with a label "Favourite Number"', () => { | ||
const div = document.createElement('div'); | ||
|
||
ReactDOM.render(<FavoriteNumber />, div); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
06-test-react-components-with-jest-and-react-testing-library/jest.config.js
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,3 @@ | ||
module.exports = { | ||
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'], | ||
}; |
Oops, something went wrong.