-
Notifications
You must be signed in to change notification settings - Fork 0
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
f7a8bfa
commit a1f99c0
Showing
13 changed files
with
44 additions
and
287 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import React from "react"; | ||
import { shallow } from 'enzyme'; | ||
import { shallow, mount, render } from 'enzyme' | ||
import Card from './Card'; | ||
|
||
it('renders without crashing', () => { | ||
expect(shallow(<Card/>)).toMatchSnapshot(); | ||
}); | ||
it('expect to render Card component', () => { | ||
expect(shallow(<Card />)).toMatchSnapshot(); | ||
}) |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import React from "react"; | ||
import { shallow } from 'enzyme'; | ||
import CardList from "./CardList"; | ||
import { shallow, mount, render } from 'enzyme' | ||
import CardList from './CardList'; | ||
|
||
const filteredRobots = [{ | ||
it('expect to render CardList component', () => { | ||
const mockRobots = [ | ||
{ | ||
id: 1, | ||
name: "Leanne Graham", | ||
username: 'Bret', | ||
email: 'Sincere@april.bz' | ||
}] | ||
|
||
it('renders without crashing', () => { | ||
expect(shallow(<CardList robots={filteredRobots}/>)).toMatchSnapshot(); | ||
}); | ||
name: 'John Snow', | ||
username: 'JohnJohn', | ||
email: 'john@gmail.com' | ||
} | ||
] | ||
expect(shallow(<CardList robots={mockRobots}/>)).toMatchSnapshot(); | ||
}) |
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,22 @@ | ||
import React from "react"; | ||
import { shallow } from 'enzyme'; | ||
import CounterButton from './CounterButton'; | ||
|
||
it('expect to render CounterButton component', () => { | ||
const mockColor = 'red'; | ||
expect(shallow(<CounterButton color={mockColor} />)).toMatchSnapshot(); | ||
}); | ||
|
||
it('correctly increments the counter', () => { | ||
const mockColor = 'red'; | ||
const wrapper = shallow(<CounterButton color={mockColor} />); | ||
|
||
wrapper.find('[id="counter"]').simulate('click'); | ||
wrapper.find('[id="counter"]').simulate('click'); | ||
expect(wrapper.state('count')).toEqual(2); | ||
wrapper.find('[id="counter"]').simulate('click'); | ||
expect(wrapper.state('count')).toEqual(3); | ||
wrapper.find('[id="counter"]').simulate('keypress'); | ||
expect(wrapper.state('count')).toEqual(3); | ||
expect(wrapper.props().color).toEqual('red'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders without crashing 1`] = ` | ||
<div | ||
className="tc grow bg-light-green br3 pa3 ma2 dib bw2 shadow-5" | ||
> | ||
<img | ||
alt="robots" | ||
src="https://robohash.org/undefined?size=200x200" | ||
/> | ||
<div> | ||
<h2 /> | ||
<p /> | ||
</div> | ||
</div> | ||
`; | ||
exports[`expect to render Card component 1`] = `ShallowWrapper {}`; |
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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders without crashing 1`] = ` | ||
<div> | ||
<Card | ||
email="Sincere@april.biz" | ||
id={1} | ||
key="0" | ||
name="Leanne Graham" | ||
/> | ||
</div> | ||
`; | ||
exports[`expect to render CardList component 1`] = `ShallowWrapper {}`; |
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 |
---|---|---|
@@ -1,21 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`correnctly increments the counter 1`] = ` | ||
<button | ||
id="counter" | ||
onClick={[Function]} | ||
> | ||
Count: | ||
0 | ||
</button> | ||
`; | ||
|
||
exports[`renders without crashing 1`] = ` | ||
<button | ||
id="counter" | ||
onClick={[Function]} | ||
> | ||
Count: | ||
0 | ||
</button> | ||
`; | ||
exports[`expect to render CounterButton component 1`] = `ShallowWrapper {}`; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { configure } from 'enzyme'; | ||
// import Adapter from 'enzyme-adapter-react-16'; only use for React 16 | ||
// import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; only use for React 17 | ||
|
||
import Adapter from '@cfaester/enzyme-adapter-react-18'; | ||
|
||
configure({ adapter: new Adapter() }); |