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
Showing
81 changed files
with
2,811 additions
and
1,371 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 |
---|---|---|
@@ -1,32 +1,29 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { enzymeFind } from 'styled-components/test-utils'; | ||
import { render, cleanup } from 'react-testing-library'; | ||
|
||
import A from '../A'; | ||
|
||
describe('<A />', () => { | ||
afterEach(cleanup); | ||
|
||
it('should render an <a> tag', () => { | ||
const wrapper = mount(<A />); | ||
const renderedComponent = enzymeFind(wrapper, A); | ||
expect(renderedComponent.type()).toEqual('a'); | ||
const { container } = render(<A />); | ||
expect(container.querySelector('a')).not.toBeNull(); | ||
}); | ||
|
||
it('should have a className attribute', () => { | ||
const wrapper = mount(<A />); | ||
const renderedComponent = enzymeFind(wrapper, A); | ||
expect(renderedComponent.prop('className')).toBeDefined(); | ||
it('should have a class attribute', () => { | ||
const { container } = render(<A />); | ||
expect(container.querySelector('a').hasAttribute('class')).toBe(true); | ||
}); | ||
|
||
it('should adopt a valid attribute', () => { | ||
const id = 'test'; | ||
const wrapper = mount(<A id={id} />); | ||
const renderedComponent = enzymeFind(wrapper, A); | ||
expect(renderedComponent.prop('id')).toEqual(id); | ||
const { container } = render(<A id={id} />); | ||
expect(container.querySelector('a').id).toEqual(id); | ||
}); | ||
|
||
it('should not adopt an invalid attribute', () => { | ||
const wrapper = mount(<A attribute="test" />); | ||
const renderedComponent = enzymeFind(wrapper, A); | ||
expect(renderedComponent.prop('attribute')).toBeUndefined(); | ||
const { container } = render(<A attribute="test" />); | ||
expect(container.querySelector('a[attribute="test"]')).toBeNull(); | ||
}); | ||
}); |
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,32 +1,29 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { enzymeFind } from 'styled-components/test-utils'; | ||
import { render, cleanup } from 'react-testing-library'; | ||
|
||
import StyledButton from '../StyledButton'; | ||
|
||
describe('<StyledButton />', () => { | ||
afterEach(cleanup); | ||
|
||
it('should render an <button> tag', () => { | ||
const wrapper = mount(<StyledButton />); | ||
const renderedComponent = enzymeFind(wrapper, StyledButton); | ||
expect(renderedComponent.type()).toEqual('button'); | ||
const { container } = render(<StyledButton />); | ||
expect(container.querySelector('button')).not.toBeNull(); | ||
}); | ||
|
||
it('should have a className attribute', () => { | ||
const wrapper = mount(<StyledButton />); | ||
const renderedComponent = enzymeFind(wrapper, StyledButton); | ||
expect(renderedComponent.prop('className')).toBeDefined(); | ||
it('should have a class attribute', () => { | ||
const { container } = render(<StyledButton />); | ||
expect(container.querySelector('button').hasAttribute('class')).toBe(true); | ||
}); | ||
|
||
it('should adopt a valid attribute', () => { | ||
const id = 'test'; | ||
const wrapper = mount(<StyledButton id={id} />); | ||
const renderedComponent = enzymeFind(wrapper, StyledButton); | ||
expect(renderedComponent.prop('id')).toEqual(id); | ||
const { container } = render(<StyledButton id={id} />); | ||
expect(container.querySelector('button').id).toEqual(id); | ||
}); | ||
|
||
it('should not adopt an invalid attribute', () => { | ||
const wrapper = mount(<StyledButton attribute="test" />); | ||
const renderedComponent = enzymeFind(wrapper, StyledButton); | ||
expect(renderedComponent.prop('attribute')).toBeUndefined(); | ||
const { container } = render(<StyledButton attribute="test" />); | ||
expect(container.querySelector('button[attribute="test"]')).toBeNull(); | ||
}); | ||
}); |
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,32 +1,29 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { enzymeFind } from 'styled-components/test-utils'; | ||
import { render, cleanup } from 'react-testing-library'; | ||
|
||
import Wrapper from '../Wrapper'; | ||
|
||
describe('<Wrapper />', () => { | ||
afterEach(cleanup); | ||
|
||
it('should render an <div> tag', () => { | ||
const wrapper = mount(<Wrapper />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.type()).toEqual('div'); | ||
const { container } = render(<Wrapper />); | ||
expect(container.querySelector('div')).not.toBeNull(); | ||
}); | ||
|
||
it('should have a className attribute', () => { | ||
const wrapper = mount(<Wrapper />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('className')).toBeDefined(); | ||
it('should have a class attribute', () => { | ||
const { container } = render(<Wrapper />); | ||
expect(container.querySelector('div').hasAttribute('class')).toBe(true); | ||
}); | ||
|
||
it('should adopt a valid attribute', () => { | ||
const id = 'test'; | ||
const wrapper = mount(<Wrapper id={id} />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('id')).toEqual(id); | ||
const { container } = render(<Wrapper id={id} />); | ||
expect(container.querySelector('div').id).toEqual(id); | ||
}); | ||
|
||
it('should not adopt an invalid attribute', () => { | ||
const wrapper = mount(<Wrapper attribute="test" />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('attribute')).toBeUndefined(); | ||
const { container } = render(<Wrapper attribute="test" />); | ||
expect(container.querySelector('div[attribute="test"]')).toBeNull(); | ||
}); | ||
}); |
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,32 +1,31 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { enzymeFind } from 'styled-components/test-utils'; | ||
import { cleanup, render } from 'react-testing-library'; | ||
|
||
import Wrapper from '../Wrapper'; | ||
|
||
describe('<Wrapper />', () => { | ||
it('should render a <footer> tag', () => { | ||
const wrapper = mount(<Wrapper />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.type()).toEqual('footer'); | ||
afterEach(cleanup); | ||
|
||
it('should render an <footer> tag', () => { | ||
const { container } = render(<Wrapper />); | ||
expect(container.querySelector('footer')).not.toBeNull(); | ||
}); | ||
|
||
it('should have a className attribute', () => { | ||
const wrapper = mount(<Wrapper />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('className')).toBeDefined(); | ||
it('should have a class attribute', () => { | ||
const { container } = render(<Wrapper />); | ||
expect(container.querySelector('footer').hasAttribute('class')).toBe(true); | ||
}); | ||
|
||
it('should adopt a valid attribute', () => { | ||
const id = 'test'; | ||
const wrapper = mount(<Wrapper id={id} />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('id')).toEqual(id); | ||
const { container } = render(<Wrapper id={id} />); | ||
expect(container.querySelector('footer').id).toEqual(id); | ||
}); | ||
|
||
it('should not adopt an invalid attribute', () => { | ||
const wrapper = mount(<Wrapper attribute="test" />); | ||
const renderedComponent = enzymeFind(wrapper, Wrapper); | ||
expect(renderedComponent.prop('attribute')).toBeUndefined(); | ||
const { container } = render(<Wrapper attribute="test" />); | ||
expect( | ||
container.querySelector('footer').getAttribute('attribute'), | ||
).toBeNull(); | ||
}); | ||
}); |
49 changes: 49 additions & 0 deletions
49
app/components/Footer/tests/__snapshots__/index.test.js.snap
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,49 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Footer /> should render and match the snapshot 1`] = ` | ||
<footer | ||
className="Wrapper-wcfdfo-0 dPvBog" | ||
> | ||
<section> | ||
<span> | ||
This project is licensed under the MIT license. | ||
</span> | ||
</section> | ||
<section> | ||
<div | ||
className="Wrapper-xnjoq9-0 dNmQIR" | ||
> | ||
<select | ||
className="Select-sc-1sm01tk-0 wIjFa" | ||
onChange={[Function]} | ||
value="en" | ||
> | ||
<option | ||
value="en" | ||
> | ||
en | ||
</option> | ||
<option | ||
value="de" | ||
> | ||
de | ||
</option> | ||
</select> | ||
</div> | ||
</section> | ||
<section> | ||
<span> | ||
Made with love by | ||
<a | ||
className="A-br8h0y-0 dwVNvo" | ||
href="https://twitter.com/mxstbr" | ||
> | ||
Max Stoiber | ||
</a> | ||
. | ||
</span> | ||
</section> | ||
</footer> | ||
`; |
Oops, something went wrong.