-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging already implemented redux-toolkit changes.
Read the discussion #2906
- Loading branch information
Showing
105 changed files
with
1,034 additions
and
1,006 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
Validating CODEOWNERS rules …
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,2 +1,2 @@ | ||
# Global owners | ||
* @julienben @gretzky @justingreenberg @jwinn @Mensae | ||
* @julienben @gretzky @justingreenberg @jwinn |
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,30 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import 'jest-styled-components'; | ||
|
||
import HeaderLink from '../HeaderLink'; | ||
|
||
const renderComponent = (props = {}) => { | ||
const utils = render( | ||
<MemoryRouter> | ||
<HeaderLink to="/test" {...props}> | ||
HeaderLink | ||
</HeaderLink> | ||
</MemoryRouter>, | ||
); | ||
const headerLink = utils.queryByText('HeaderLink'); | ||
return { ...utils, headerLink }; | ||
}; | ||
|
||
describe('<HeaderLink />', () => { | ||
it('should match the snapshot', () => { | ||
const { container } = renderComponent(); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should have a class attribute', () => { | ||
const { headerLink } = renderComponent(); | ||
expect(headerLink).toHaveAttribute('class'); | ||
}); | ||
}); |
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,27 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import 'jest-styled-components'; | ||
|
||
import NavBar from '../NavBar'; | ||
|
||
const renderComponent = (props = {}) => { | ||
const { container } = render(<NavBar {...props} />); | ||
return container; | ||
}; | ||
|
||
describe('<NavBar />', () => { | ||
it('should match the snapshot', () => { | ||
const container = renderComponent(); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should have a class attribute', () => { | ||
const container = renderComponent(); | ||
expect(container.firstChild).toHaveAttribute('class'); | ||
}); | ||
|
||
it('should not adopt an invalid attribute', () => { | ||
const container = renderComponent({ attribute: 'test' }); | ||
expect(container.firstChild).not.toHaveAttribute('attribute'); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
app/components/Header/tests/__snapshots__/HeaderLink.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,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<HeaderLink /> should match the snapshot 1`] = ` | ||
.c0 { | ||
display: -webkit-inline-box; | ||
display: -webkit-inline-flex; | ||
display: -ms-inline-flexbox; | ||
display: inline-flex; | ||
padding: 0.25em 2em; | ||
margin: 1em; | ||
-webkit-text-decoration: none; | ||
text-decoration: none; | ||
border-radius: 4px; | ||
-webkit-font-smoothing: antialiased; | ||
-webkit-touch-callout: none; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
cursor: pointer; | ||
outline: 0; | ||
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; | ||
font-weight: bold; | ||
font-size: 16px; | ||
border: 2px solid #41addd; | ||
color: #41addd; | ||
} | ||
.c0:active { | ||
background: #41addd; | ||
color: #fff; | ||
} | ||
<a | ||
class="c0" | ||
href="/test" | ||
> | ||
HeaderLink | ||
</a> | ||
`; |
11 changes: 11 additions & 0 deletions
11
app/components/Header/tests/__snapshots__/NavBar.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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<NavBar /> should match the snapshot 1`] = ` | ||
.c0 { | ||
text-align: center; | ||
} | ||
<div | ||
class="c0" | ||
/> | ||
`; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* Test the repo list item | ||
*/ | ||
|
||
import React from 'react'; | ||
import { getByText, render } from '@testing-library/react'; | ||
import { IntlProvider } from 'react-intl'; | ||
|
||
import RepoListItem from '../index'; | ||
|
||
const renderComponent = item => | ||
render( | ||
<IntlProvider locale="en"> | ||
<RepoListItem item={item} /> | ||
</IntlProvider>, | ||
); | ||
|
||
describe('<RepoListItem />', () => { | ||
let ownedItem; | ||
let notOwnedItem; | ||
|
||
// Before each test reset the item data for safety | ||
beforeEach(() => { | ||
// Repo owned by the user whose account we're querying | ||
ownedItem = { | ||
isOwnRepo: true, | ||
owner: { | ||
login: 'repo-owner', | ||
}, | ||
html_url: 'https://github.com/repo-owner/repo_name', | ||
name: 'repo_name', | ||
open_issues_count: 20, | ||
full_name: 'repo-owner/repo-name', | ||
}; | ||
|
||
// Repo NOT owned by the user whose account we're querying | ||
notOwnedItem = { | ||
isOwnRepo: false, | ||
owner: { | ||
login: 'repo-owner', | ||
}, | ||
html_url: 'https://github.com/repo-owner/repo_name', | ||
name: 'repo_name', | ||
open_issues_count: 20, | ||
full_name: 'repo-owner/repo-name', | ||
}; | ||
}); | ||
|
||
it('should render a ListItem', () => { | ||
const { container } = renderComponent(notOwnedItem); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should not render the username if repo is owned by user', () => { | ||
const { queryByText } = renderComponent(ownedItem); | ||
expect(queryByText(ownedItem.owner.login)).toBeNull(); | ||
}); | ||
|
||
it('should render username if the repo belongs to a differet user or org', () => { | ||
const { container } = renderComponent(notOwnedItem); | ||
expect( | ||
getByText(container, content => | ||
content.startsWith(notOwnedItem.owner.login), | ||
), | ||
).not.toBeNull(); | ||
}); | ||
|
||
it('should render the repo name', () => { | ||
const { container } = renderComponent(ownedItem); | ||
expect( | ||
getByText(container, content => content.endsWith(ownedItem.name)), | ||
).not.toBeNull(); | ||
}); | ||
|
||
it('should render the issue count', () => { | ||
const { container } = renderComponent(ownedItem); | ||
expect( | ||
getByText(container, ownedItem.open_issues_count.toString(10)), | ||
).not.toBeNull(); | ||
}); | ||
|
||
it('should render the IssueIcon', () => { | ||
const { container } = renderComponent(ownedItem); | ||
expect(container.querySelector('svg')).not.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
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
Oops, something went wrong.